summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hypnotisml.lisp8
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)))