Skip to content

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

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

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 the css-select adapter already provided by the native WPT stack (#86). Selector compilation and SyntaxError conversion are inherited from that implementation.

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. These cases now execute directly from the original upstream HTML files with their complete setup and assertions.

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.

The original child-indexed source also creates a DocumentFragment during file setup. That prerequisite is now provided by #90, beneath #70, so the selected cases execute with the complete upstream setup.

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

@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: 230f116

@cowboyd
cowboyd marked this pull request as ready for review November 15, 2026 22:33
@cowboyd
cowboyd added this pull request to stack #82 November 16, 2026 04:11
@cowboyd
cowboyd marked this pull request as draft November 17, 2026 17:45
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