CSS :has() in selectors
The relational pseudo-class: matches an element when a relative selector matches something around it. Specification: drafts.csswg.org/selectors-4/.
Results
Probed on 2026-10-19 with Node.js v22.23.3.
warpdom 0.1.6
Supported3 of 3 checks work.
Report a wrong result for warpdomhappy-dom 21.0.3
Supported3 of 3 checks work.
Report a wrong result for happy-domjsdom 30.1.3
Supported3 of 3 checks work.
Report a wrong result for jsdomlinkedom 0.18.13
Supported3 of 3 checks work.
Report a wrong result for linkedomChecks
Exists when: document.querySelector(":has(*)") does not throw a SyntaxError.
descendant: querySelectorAll("div:has(.x)") matches both divs that contain a .x descendant. (spec)child-combinator: querySelectorAll("div:has(> .x)") matches only the div with a .x child. (spec)matches-closest: element.matches(":has(.x)") and element.closest(":has(> p)") use :has() as well. (spec)