diff options
author | colin <colin@cicadas.surf> | 2024-06-22 14:53:18 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-06-22 14:53:18 -0700 |
commit | b6d59c01066ab2315e84fe7eb5659e376e56de1b (patch) | |
tree | d42888fad2e5caa5716ebde139e46d2b57258157 /src | |
parent | 4602591267732858e7125fdfabb781d8f23d6d2f (diff) |
Add: parenscript dep; Fix: html elem render; Fix: <elem-replace>
Diffstat (limited to 'src')
-rw-r--r-- | src/hypnotisml.lisp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp index 5b0a7dd..d39844a 100644 --- a/src/hypnotisml.lisp +++ b/src/hypnotisml.lisp @@ -81,6 +81,9 @@ (children :type node-list) :documentation "The base class for all UI elements.") +(defun elem-query-selector (elem) + (format nil "[data-hypno-id=~s]" (elem-id elemp))) + (defmethod print-object ((object elem) stream) (indent stream) @@ -168,8 +171,7 @@ (format t " ~{~a=~s~^ ~}" (attribs-list attributes))) (when (and style (styles-list style)) - (when attributes (write-char #\space)) - (write-string "style=") + (write-string " style=") (write-char #\") (format t "~{~a:~a;~}" (styles-list style)) (write-char #\")) @@ -412,7 +414,7 @@ ;;; Parenscript (ps:defpsmacro <elem> (elem) - `(ps:@ document (get-element-by-id (ps:lisp (elem-id ,elem))))) + `(ps:chain document (query-selector (ps:lisp (elem-query-selector ,elem))))) (ps:defpsmacro <replace-elem> (elem innerhtml) (let ((template (ps:ps-gensym))) |