diff options
Diffstat (limited to 'src/hypnotisml.lisp')
-rw-r--r-- | src/hypnotisml.lisp | 18 |
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)))))) + |