HS take command: class/attr with+giving, attr removal from scope, giving keyword
- tokenizer: add 'giving' as keyword so parse-take-cmd can detect it.
- parser.sx parse-take-cmd: loop over 'with <class>' / 'giving <class>' /
'from <sel>' / 'for <tgt>' clauses in any order for both the class and
attribute cases. Emits uniform (take! kind name from-sel for-tgt
attr-val with-val) 7-slot AST.
- compiler emit-take: pass with-cls for the class case through to runtime.
- runtime hs-take!: with a class 'with' replacement, toggle both classes
across scope + target. For attribute take, always strip the attr from
the scope 'others' (setting to with-val if given, otherwise removing).
- generator pw-body: translate evaluate(() => document.querySelector(s).
click()) and .dispatchEvent(new Event('name', …)) into dom-dispatch ops
so bubbling-click assertions in 'parent takes…' tests work.
- generator toHaveClass: strip JS regex word-boundaries (\\b) from the
expected class name.
- shared/static/wasm/sx/dom.sx: dom-child-list / dom-child-nodes mirror
the dom-query-all SX-list passthrough — childNodes arrives pre-SXified.
Net: take 6→15 (100%), remove 16→17, fetch 11→15.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1621,18 +1621,35 @@
|
||||
((nil? from-sel) nil)
|
||||
((and (list? from-sel) (= (first from-sel) (quote query)))
|
||||
(list (quote hs-query-all) (nth from-sel 1)))
|
||||
(true (hs-to-sx from-sel)))))
|
||||
(if
|
||||
(and (= kind "attr") (or attr-val with-val))
|
||||
(list
|
||||
(quote hs-take!)
|
||||
target
|
||||
kind
|
||||
name
|
||||
scope
|
||||
attr-val
|
||||
(if with-val (hs-to-sx with-val) nil))
|
||||
(list (quote hs-take!) target kind name scope)))))
|
||||
(true (hs-to-sx from-sel))))
|
||||
(with-sx
|
||||
(if
|
||||
with-val
|
||||
(if
|
||||
(string? with-val)
|
||||
with-val
|
||||
(hs-to-sx with-val))
|
||||
nil)))
|
||||
(cond
|
||||
((and (= kind "attr") (or attr-val with-val))
|
||||
(list
|
||||
(quote hs-take!)
|
||||
target
|
||||
kind
|
||||
name
|
||||
scope
|
||||
attr-val
|
||||
with-sx))
|
||||
((and (= kind "class") with-val)
|
||||
(list
|
||||
(quote hs-take!)
|
||||
target
|
||||
kind
|
||||
name
|
||||
scope
|
||||
nil
|
||||
with-sx))
|
||||
(true (list (quote hs-take!) target kind name scope))))))
|
||||
((= head (quote make)) (emit-make ast))
|
||||
((= head (quote install))
|
||||
(cons (quote hs-install) (map hs-to-sx (rest ast))))
|
||||
|
||||
Reference in New Issue
Block a user