HS: put hyperscript reprocessing — generator fix (+1 test)
Partial fix. The generator's block-form `evaluate(() => { ... })`
swallowed blocks that weren't window-setup assignments (e.g. `const e =
new Event(...); elem.dispatchEvent(e);`). It now only `continue`s when
at least one window-setup pair was parsed; otherwise falls through to
downstream patterns. Also added a new pattern that recognises the
`evaluate(() => { const e = new Event(...); document.querySelector(SEL)
.dispatchEvent(e); })` shape and emits a `dom-dispatch` op.
Still failing: "at start of", "in a element target", "in a symbol
write" — root cause here is that the inserted-button's hyperscript
handler still isn't activating in the afterbegin / innerHTML paths.
Tracked separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9627,6 +9627,7 @@
|
||||
(hs-activate! _el-d1)
|
||||
(dom-dispatch (dom-query-by-id "d1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "40")
|
||||
(dom-dispatch (dom-query-by-id "b1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "42")
|
||||
))
|
||||
(deftest "properly processes hyperscript at start of"
|
||||
@@ -9638,6 +9639,7 @@
|
||||
(hs-activate! _el-d1)
|
||||
(dom-dispatch (dom-query-by-id "d1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "40")
|
||||
(dom-dispatch (dom-query-by-id "b1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "42")
|
||||
))
|
||||
(deftest "properly processes hyperscript in before"
|
||||
@@ -9661,6 +9663,7 @@
|
||||
(hs-activate! _el-d1)
|
||||
(dom-dispatch (dom-query-by-id "d1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "40")
|
||||
(dom-dispatch (dom-query-by-id "b1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "42")
|
||||
))
|
||||
(deftest "properly processes hyperscript in new content in a symbol write"
|
||||
@@ -9671,6 +9674,7 @@
|
||||
(hs-activate! _el-div)
|
||||
(dom-dispatch _el-div "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "40")
|
||||
(dom-dispatch (dom-query-by-id "b1") "click" nil)
|
||||
(assert= (dom-text-content (dom-query-by-id "b1")) "42")
|
||||
))
|
||||
(deftest "put null into attribute removes it"
|
||||
|
||||
Reference in New Issue
Block a user