summaryrefslogtreecommitdiff
path: root/src/hypnotisml.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-11-07 06:16:27 -0800
committercolin <colin@cicadas.surf>2024-11-07 06:16:27 -0800
commitaae175e6b9febf3fb80ca3e683af2e6227307079 (patch)
treef3bdb8f73b6b591790a7503f4092b5a05f7b097b /src/hypnotisml.lisp
parent8ca553e91da3947a55d8b58b0a16a43e1ad6ce24 (diff)
doctype
Diffstat (limited to 'src/hypnotisml.lisp')
-rw-r--r--src/hypnotisml.lisp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp
index a009835..846e30f 100644
--- a/src/hypnotisml.lisp
+++ b/src/hypnotisml.lisp
@@ -66,6 +66,13 @@
(parent :type (or null elem))
:documentation "Root class for all dom-nodes")
+(def:class doctype-html (node)
+ :documentation "<!DOCTYPE html>")
+
+(defun <!doctype> (&rest ignore)
+ (declare (ignore ignore))
+ (make-instance 'doctype-html))
+
(defun node-p (x) (typep x 'node))
(defun node-list-p (es)
@@ -313,6 +320,8 @@ already present in the element."
(indent stream)
(write-string (text-content text) stream))
+(defmethod html ((doctype-html doctype-html) stream)
+ (write-string "<!DOCTYPE html>" stream))
;;; ELEM BUILDERS
@@ -493,6 +502,7 @@ CONTENTS is a list of NODE instances."
video
wbr))
+
;;; CONVENIENCE ELEMENT BUILDERS
(defun <checkbox> (&key checked name)
@@ -609,13 +619,9 @@ E.g. :1/2, :1, :3/4"
;;; PARENSCRIPT
-(ps:defpsmacro js.elem (elem)
+(ps:defpsmacro js-elem (elem)
`(ps:chain document (query-selector (ps:lisp (elem-query-selector ,elem)))))
-(ps:defpsmacro js.replace (elem innerhtml)
- (let ((template (ps:ps-gensym)))
- `(let ((,template (ps:chain document (create-element "template"))))
- (setf (ps:@ ,template inner-h-t-m-l) ,innerhtml)
- (ps:chain ($$ ,elem) (replace-with (ps:@ ,template content))))))
+