Skip to content

Add initial Element.matches support with css-select - #80

Open
cowboyd wants to merge 1 commit into
dom-get-element-by-idfrom
dom-selectors
Open

cowboyd wants to merge 1 commit into
dom-get-element-by-idfrom
dom-selectors

Conversation

@cowboyd

@cowboyd cowboyd commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

The WPT relies heavily on query selectors functioning (along with an HTML parser for fixtures). This begins adding CSS selector support to our dom.

The first proof of concept is Element.matches() support using css-select and an adapter for the UI DOM. The adapter supplies element names, attributes, text, and tree traversal; selector compilation failures become SyntaxError DOMExceptions.

Adds WPT coverage for unqualified tag names on namespaced elements, the default inactive state of :active, invalid selector syntax, and child-indexed pseudo-classes on detached elements. Existing static HTML fixtures load through the document factory, preserving their assertions while removing the adaptations' incidental dependency on innerHTML.

Limtations:

  • Detached elements incorrectly fail the four :nth-*(n) selectors because of css-select #1945. Those four WPT cases are temporarily excluded in the UI configuration until the upstream issue is fixed.
  • The *|h case is excluded because css-select rejects namespace-qualified tag selectors.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@socket-security

socket-security Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcss-select@​7.0.010010010081100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bombshell-dev/ui/@clack/ui@80

commit: 04dde52

@cowboyd
cowboyd marked this pull request as ready for review November 15, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant