summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hypnotisml.lisp10
-rw-r--r--src/package.lisp6
2 files changed, 9 insertions, 7 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))))))
+
+
diff --git a/src/package.lisp b/src/package.lisp
index 5743aa3..36d975b 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -169,9 +169,9 @@
#:$hcenter)
;; parenscript macros
- ;; (:export
- ;; #:$$
- ;; #:$$replace)
+ (:export
+ #:js.elem
+ #:js.replace)
;; transforms and structure editing
(:export