From 98c957b3bf143ebede0ff380e5fe558c2c2f7653 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 24 Apr 2026 06:30:17 +0000 Subject: [PATCH] HS: show multi-element + display retention (+2 tests) Two fixes in `tests/hs-run-filtered.js`: (a) `mt` (matches-selector) now splits comma-separated selector lists and matches if any clause matches, so `qsa("#d1, #d2")` returns both elements. (b) `host-get` on an `El` for `innerText` returns `textContent` (DOM-level alias) so `when its innerText contains "foo"` predicates can see the mock's stored text. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/hs-run-filtered.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/hs-run-filtered.js b/tests/hs-run-filtered.js index 652192e9..7dcc155d 100755 --- a/tests/hs-run-filtered.js +++ b/tests/hs-run-filtered.js @@ -239,6 +239,10 @@ function parseHTMLFragments(html) { function mt(e,s) { if(!e||!e.tagName)return false; s = s.trim(); + // Comma-separated selector list — any clause matches + if (s.includes(',')) { + return s.split(',').some(part => mt(e, part.trim())); + } // Strip pseudo-classes we handle at the fnd() level (nth-of-type, first/last-of-type) const pseudo = s.match(/^(.*?):(nth-of-type|first-of-type|last-of-type)(?:\((\d+)\))?$/); const base = pseudo ? pseudo[1] : s; @@ -297,6 +301,8 @@ K.registerNative('host-get',a=>{ // compiled HS `x.length` / `x.size` works on scoped lists. if(a[0] && a[0]._type==='list' && (a[1]==='length' || a[1]==='size')) return a[0].items.length; if(a[0] && a[0]._type==='dict' && a[1]==='size') return Object.keys(a[0]).filter(k=>k!=='_type').length; + // innerText is DOM-level alias for textContent (close enough for mock purposes) + if(a[0] instanceof El && a[1]==='innerText') return String(a[0].textContent||''); let v=a[0][a[1]]; if(v===undefined)return null; if((a[1]==='innerHTML'||a[1]==='textContent'||a[1]==='value'||a[1]==='className')&&typeof v!=='string')v=String(v!=null?v:'');