diff --git a/lib/hyperscript/compiler.sx b/lib/hyperscript/compiler.sx index 8beb2afe..c09941b9 100644 --- a/lib/hyperscript/compiler.sx +++ b/lib/hyperscript/compiler.sx @@ -69,14 +69,20 @@ (list (quote host-get) (hs-to-sx obj-ast) (nth base 1)) prop-name value)) - ;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value) - (if (and (list? prop-ast) (= (first prop-ast) (quote ref))) - (list (quote dom-set-prop) + ;; (attr "name") of obj → (dom-set-attr (compiled-obj) "name" value) + (if (and (list? prop-ast) (= (first prop-ast) (quote attr))) + (list (quote dom-set-attr) (hs-to-sx obj-ast) (nth prop-ast 1) value) - ;; Fallback - (list (quote set!) (hs-to-sx target) value))))) + ;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value) + (if (and (list? prop-ast) (= (first prop-ast) (quote ref))) + (list (quote dom-set-prop) + (hs-to-sx obj-ast) + (nth prop-ast 1) + value) + ;; Fallback + (list (quote set!) (hs-to-sx target) value)))))) (true (list (quote set!) (hs-to-sx target) value))))))) (define emit-on diff --git a/shared/static/wasm/sx/hs-compiler.sx b/shared/static/wasm/sx/hs-compiler.sx index 8beb2afe..c09941b9 100644 --- a/shared/static/wasm/sx/hs-compiler.sx +++ b/shared/static/wasm/sx/hs-compiler.sx @@ -69,14 +69,20 @@ (list (quote host-get) (hs-to-sx obj-ast) (nth base 1)) prop-name value)) - ;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value) - (if (and (list? prop-ast) (= (first prop-ast) (quote ref))) - (list (quote dom-set-prop) + ;; (attr "name") of obj → (dom-set-attr (compiled-obj) "name" value) + (if (and (list? prop-ast) (= (first prop-ast) (quote attr))) + (list (quote dom-set-attr) (hs-to-sx obj-ast) (nth prop-ast 1) value) - ;; Fallback - (list (quote set!) (hs-to-sx target) value))))) + ;; Simple: (ref "prop") of obj → (dom-set-prop (compiled-obj) "prop" value) + (if (and (list? prop-ast) (= (first prop-ast) (quote ref))) + (list (quote dom-set-prop) + (hs-to-sx obj-ast) + (nth prop-ast 1) + value) + ;; Fallback + (list (quote set!) (hs-to-sx target) value)))))) (true (list (quote set!) (hs-to-sx target) value))))))) (define emit-on