Skip to content

Add Document.querySelector for native WPT fixture lookup - #86

Merged
cowboyd merged 1 commit into
mainfrom
dom-document-selectors
Nov 18, 2026
Merged

cowboyd merged 1 commit into
mainfrom
dom-document-selectors

Conversation

@cowboyd

@cowboyd cowboyd commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

See #87 for the endgame.

We want to run WPT test cases directly without any changes to the upstream and without hosting hundreds approximations of those tests in our repository.

The element-creation files use document.querySelector() to locate iframe fixtures during shared setup, even when only their HTML-document cases are selected.

Add Document.querySelector() through the css-select adapter, returning the first match or null and converting selector compilation errors to SyntaxError. The adapter is reused unchanged from the earlier selector work. See the DOM specification's scope-matching algorithm.

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 17, 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 17, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: b9038b3

@cowboyd
cowboyd added this pull request to stack #88 November 17, 2026 05:00
@cowboyd
cowboyd marked this pull request as ready for review November 17, 2026 05:12
@cowboyd
cowboyd force-pushed the dom-document-selectors branch from 21d311f to 9627b11 Compare November 17, 2026 21:43
@cowboyd
cowboyd force-pushed the dom-document-selectors branch 2 times, most recently from 802c386 to d3e154c Compare November 17, 2026 22:01
Comment thread packages/ui/src/css-select.ts Resolved
},

getParent(node): Node | null {
return node.parentNode;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be node.parentElement? I didn't check the adapter interface but this surprised me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that css-select is expecting any and all nodes and does explicit checking if it is an element. 🤷🏻‍♂️

Comment thread packages/ui/src/css-select.ts Resolved
Comment thread packages/ui/package.json Resolved
@cowboyd
cowboyd removed this pull request from stack #88 November 18, 2026 02:26
@cowboyd
cowboyd added this pull request to stack #97 November 18, 2026 02:26
@cowboyd
cowboyd force-pushed the dom-document-selectors branch from d3e154c to e5eee13 Compare November 18, 2026 02:41
Base automatically changed from dom-create-document to main November 18, 2026 02:43
@cowboyd
cowboyd force-pushed the dom-document-selectors branch from e5eee13 to b9038b3 Compare November 18, 2026 02:43
@cowboyd
cowboyd merged commit 91e0386 into main Nov 18, 2026
8 of 10 checks passed
@cowboyd
cowboyd deleted the dom-document-selectors branch November 18, 2026 02:44
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.

2 participants