Skip to main content

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​

Supported

3 of 3 checks work.

Report a wrong result for warpdom

happy-dom 21.0.3​

Supported

3 of 3 checks work.

Report a wrong result for happy-dom

jsdom 30.1.3​

Supported

3 of 3 checks work.

Report a wrong result for jsdom

linkedom 0.18.13​

Supported

3 of 3 checks work.

Report a wrong result for linkedom

Checks​

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)