Skip to content

Run upstream WPT sources directly and remove the adapted suite - #87

Open
cowboyd wants to merge 5 commits into
mainfrom
dom-default-view
Open

cowboyd wants to merge 5 commits into
mainfrom
dom-default-view

Conversation

@cowboyd

@cowboyd cowboyd commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Run original Web Platform Test HTML files through Vitest file transforms, replacing the adapted TypeScript suite.

2026-11-16 22 53 08

Consumers integrate through a single wpt.config.ts supplying a document factory, globals, and case selection.

Each upstream file runs in a fresh Node worker and appears as a separate test file. The worker loads the consumer configuration, then runs its DOM implementation and the upstream scripts in the same JavaScript realm, so native and implementation-thrown errors share constructors and prototypes. The harness populates HTML through parse5, executes scripts and helpers in source order, and uses upstream testharness.js for assertions and scheduling. The harness supplies window.document, attaches document.defaultView, and delivers window load after the scripts finish.

The fixture also supplies live Window named properties through a proxy in the worker global's prototype chain. Single-element IDs and eligible HTML names resolve against the current document tree; existing globals take precedence. Multiple matches requiring live collections and child browsing-context names remain unsupported.

The runner terminates the worker after each file. Timeouts include worker startup and configuration loading; a parent watchdog allows 250 ms for ordinary timeout results before terminating an unresponsive worker. Consumer configurations do not need to override standard error constructors.

Every subtest in a selected file executes to preserve shared state; selection filters only the reported results. Browser navigation and parser-driven script timing remain unsupported. Window event delegation currently requires extensible event objects.

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
Added@​bomb.sh/​router@​0.8.0781009995100
Addedparse5@​8.1.1931008892100

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@87

commit: f7077a8

@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:22
@cowboyd
cowboyd force-pushed the dom-default-view branch 2 times, most recently from 3c336fc to f0a04b3 Compare November 17, 2026 21:59
cowboyd added a commit that referenced this pull request Nov 17, 2026
## 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. Those files create additional documents and doctypes
during shared setup, so the implementation needs those factories before
the harness can execute them directly.

Add
[`DocumentType`](https://dom.spec.whatwg.org/#interface-documenttype),
[`DOMImplementation.createDocumentType()`](https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype),
and
[`createHTMLDocument()`](https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument).
HTML creation supplies a doctype, `<html>`, `<head>`, an optional
`<title>`, and `<body>`. Bare documents start empty; `documentElement`,
`doctype`, `head`, and `body` reflect the current tree. UI construction
uses the HTML factory.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor (no behavior change)
- [ ] Documentation
- [ ] Performance improvement
- [ ] Tests
- [ ] Chore (dependencies, CI, tooling)

## Checklist

- [ ] I have added a changeset

## AI-generated code disclosure

- [x] This PR includes AI-generated code

@natemoo-re natemoo-re left a comment

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.

Would love to give the test adapter another review tomorrow!

Comment thread packages/ui/package.json
"format": "bsh format",
"lint": "bsh lint",
"test": "pnpm --filter @bomb.sh/web-platform-tests build && bsh test"
"test": "pnpm --filter @bomb.sh/web-platform-tests build && bsh test && wpt"

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.

We could use pnpm tasks to automatically run build before test

@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 added a commit that referenced this pull request Nov 18, 2026
## 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. `Document-createAttribute.html` and
`Node-textContent.html` create XML documents during shared setup, before
their selected cases run.

Implement
[`DOMImplementation.createDocument()`](https://dom.spec.whatwg.org/#dom-domimplementation-createdocument),
returning an [`XMLDocument`](https://dom.spec.whatwg.org/#xmldocument)
with an optional namespaced root and doctype. Convert and validate the
factory arguments so upstream setup can use the implementation directly.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor (no behavior change)
- [ ] Documentation
- [ ] Performance improvement
- [ ] Tests
- [ ] Chore (dependencies, CI, tooling)

## Checklist

- [ ] I have added a changeset

## AI-generated code disclosure

- [x] This PR includes AI-generated code
Base automatically changed from dom-document-selectors to main November 18, 2026 02:44
cowboyd added a commit that referenced this pull request Nov 18, 2026
## 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()`](https://dom.spec.whatwg.org/#dom-parentnode-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](https://dom.spec.whatwg.org/#scope-match-a-selectors-string).


## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor (no behavior change)
- [ ] Documentation
- [ ] Performance improvement
- [ ] Tests
- [ ] Chore (dependencies, CI, tooling)

## Checklist

- [ ] I have added a changeset

## AI-generated code disclosure

- [x] This PR includes AI-generated code
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