HS: some selector for nonempty match (+1 test)

`some <html/>` compiles to (not (hs-falsy? (hs-query-first "html"))), which
called document.querySelector('html'). The mock's querySelector searched
only inside _body, so the html element wasn't found. Adjusted the mock to
return _html for the 'html' selector (and walk documentElement too).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 21:44:21 +00:00
parent f113b45d48
commit e7b8626498

View File

@@ -274,7 +274,7 @@ const document = {
createDocumentFragment(){const f=new El('fragment');f.nodeType=11;return f;},
createTextNode(t){return{nodeType:3,textContent:t,data:t};},
getElementById(i){return fnd(_body,'#'+i);},
querySelector(s){return fnd(_body,s);}, querySelectorAll(s){return fndAll(_body,s);},
querySelector(s){if(s==='html')return _html;if(s==='body')return _body;return fnd(_body,s)||(mt(_html,s)?_html:null);}, querySelectorAll(s){const r=fndAll(_body,s);if(s==='html'||mt(_html,s))r.unshift(_html);return r;},
createEvent(t){return new Ev(t);}, addEventListener(){}, removeEventListener(){},
};
globalThis.document=document; globalThis.window=globalThis; globalThis.HTMLElement=El; globalThis.Element=El;