summaryrefslogtreecommitdiff
path: root/src/hypnotisml.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-06-29 07:56:00 -0700
committercolin <colin@cicadas.surf>2024-06-29 07:56:00 -0700
commit1ca58017958cac2028d692a2889e97daa794df07 (patch)
treecfd0d96c11833a226d9f768408170b99cbcc3081 /src/hypnotisml.lisp
parentb7da7a19e98b80fdf044d3e910d866e464653b85 (diff)
Fix: element id query selector string; Change names of ps macros
Diffstat (limited to 'src/hypnotisml.lisp')
-rw-r--r--src/hypnotisml.lisp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp
index b70a8a8..13e4bab 100644
--- a/src/hypnotisml.lisp
+++ b/src/hypnotisml.lisp
@@ -105,7 +105,7 @@
(defun elem-query-selector (elem)
"Returns a CSS query selector string for the ELEM. ELEMs can be
uniquely quried in the dom by passing string to .querySelector()"
- (format nil "[data-hypno-id=~s]" (elem-id elem)))
+ (format nil "[data-hypno-id='~a']" (elem-id elem)))
(defun style (elem property)
(a:when-let (style (elem-style elem))
@@ -600,13 +600,15 @@ E.g. :1/2, :1, :3/4"
,@contents))))
-;;; Parenscript
+;;; PARENSCRIPT
-(ps:defpsmacro $$ (elem)
+(ps:defpsmacro js.elem (elem)
`(ps:chain document (query-selector (ps:lisp (elem-query-selector ,elem)))))
-(ps:defpsmacro $$replace (elem innerhtml)
+(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))))))
+
+