HS reset/first/last: defaultValue tracking, list-of-elements reset, find().first|last
Mock DOM: - El now tracks defaultValue/defaultChecked/defaultSelected and a reset() method that walks descendant form controls, restoring them. - setAttribute(value|checked|selected) sets the matching default-* too, so the initial HTML state can be restored later. - parseHTMLFragments + _setInnerHTML capture a textarea's textContent as its value AND defaultValue. Generator (pw-body): - add_action / add_assertion extract .first() / .last() / .nth(N) modifiers into (nth (dom-query-all …) i) or a (let ((_all …)) (nth _all (- … 1))) tail so multi-match helpers hit the right element. Compiler: - emit-reset! with a .<class>/.<sel> query target now compiles to hs-query-all so 'reset .resettable' resets every matching control (not just the first). Net: reset 1→8 (100%).
This commit is contained in:
@@ -1835,7 +1835,14 @@
|
||||
((= head (quote select!))
|
||||
(list (quote hs-select!) (hs-to-sx (nth ast 1))))
|
||||
((= head (quote reset!))
|
||||
(list (quote hs-reset!) (hs-to-sx (nth ast 1))))
|
||||
(let
|
||||
((raw-tgt (nth ast 1)))
|
||||
(cond
|
||||
((and (list? raw-tgt) (= (first raw-tgt) (quote query)))
|
||||
(list
|
||||
(quote hs-reset!)
|
||||
(list (quote hs-query-all) (nth raw-tgt 1))))
|
||||
(true (list (quote hs-reset!) (hs-to-sx raw-tgt))))))
|
||||
((= head (quote default!))
|
||||
(let
|
||||
((tgt-ast (nth ast 1))
|
||||
|
||||
Reference in New Issue
Block a user