HS: empty multi-element fix (+1 test)
empty .class compiled (empty-target (query ".class")) to (hs-empty-target! (hs-query-first ".class")) via hs-to-sx — only emptying the first match. Fix: detect (query ...) target in the empty-target compiler case and emit (for-each (fn (_el) (hs-empty-target! _el)) (hs-query-all sel)) instead, mirroring the add-class pattern. Suite hs-upstream-empty: 12/13 → 13/13. Smoke 0-195: 175/195 unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1547,7 +1547,17 @@
|
||||
(emit-set
|
||||
tgt
|
||||
(list (quote hs-empty-like) (hs-to-sx tgt))))
|
||||
(true (list (quote hs-empty-target!) (hs-to-sx tgt))))))
|
||||
(true
|
||||
(if
|
||||
(and (list? tgt) (= (first tgt) (quote query)))
|
||||
(list
|
||||
(quote for-each)
|
||||
(list
|
||||
(quote fn)
|
||||
(list (quote _el))
|
||||
(list (quote hs-empty-target!) (quote _el)))
|
||||
(list (quote hs-query-all) (nth tgt 1)))
|
||||
(list (quote hs-empty-target!) (hs-to-sx tgt)))))))
|
||||
((= head (quote open-element))
|
||||
(list (quote hs-open!) (hs-to-sx (nth ast 1))))
|
||||
((= head (quote close-element))
|
||||
|
||||
@@ -1547,7 +1547,17 @@
|
||||
(emit-set
|
||||
tgt
|
||||
(list (quote hs-empty-like) (hs-to-sx tgt))))
|
||||
(true (list (quote hs-empty-target!) (hs-to-sx tgt))))))
|
||||
(true
|
||||
(if
|
||||
(and (list? tgt) (= (first tgt) (quote query)))
|
||||
(list
|
||||
(quote for-each)
|
||||
(list
|
||||
(quote fn)
|
||||
(list (quote _el))
|
||||
(list (quote hs-empty-target!) (quote _el)))
|
||||
(list (quote hs-query-all) (nth tgt 1)))
|
||||
(list (quote hs-empty-target!) (hs-to-sx tgt)))))))
|
||||
((= head (quote open-element))
|
||||
(list (quote hs-open!) (hs-to-sx (nth ast 1))))
|
||||
((= head (quote close-element))
|
||||
|
||||
Reference in New Issue
Block a user