Skip to content

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

Merged
cowboyd merged 5 commits into
mainfrom
dom-default-view
Nov 18, 2026
Merged

cowboyd merged 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: 8697662

@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

@jbolda jbolda 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.

Looks good with my other than Nate's note!

@dreyfus92 dreyfus92 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.

this is a big step up, running upstream files directly is way easier to trust than the adapted copies, and it's nice that a typo'd or deleted selection fails loudly. left a few questions inline, none blocking

one more that doesn't fit on a line: does anything still check the frameworks.ts profiles now that frameworks.test.ts is gone? nothing seems to call framework() anymore, so they could drift

Comment thread packages/ui/wpt.config.ts Resolved
Comment thread packages/ui/wpt.config.ts Resolved
@cowboyd
cowboyd merged commit 8c4d931 into main Nov 18, 2026
8 of 10 checks passed
@cowboyd
cowboyd deleted the dom-default-view branch November 18, 2026 21:50
@cowboyd cowboyd mentioned this pull request Nov 18, 2026
4 of 12 tasks
@jbolda jbolda mentioned this pull request Nov 19, 2026
3 of 12 tasks
jbolda added a commit that referenced this pull request Nov 19, 2026
## What does this PR do?

<!--
Describe the change and why it's needed. Link to a related issue or
discussion.
  If there is no issue, please explain why one isn't needed.
-->

Following up on
#87 (comment)

Looking to improve the DX here where `pnpm i` and `pnpm test` Just Works
(tm). Both `test:unit` and `test:wpt` run in watch mode by default, but
take a `--run` which is what we use in CI.

## Type of change

<!-- Check one. -->

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

## Checklist

- [x] All tests pass (`pnpm test`)
- [x] Files are formatted (`pnpm format`)
- [ ] I have added/updated tests for my changes (if applicable)
- [ ] I have added a changeset

## AI-generated code disclosure

<!-- If any part of this PR was generated by AI tools (Copilot, Claude,
GPT, Cursor, etc.), check the box. This is fine — we just need to know
so reviewers can pay extra attention to edge cases. -->

- [ ] This PR includes AI-generated code
cowboyd added a commit that referenced this pull request Nov 23, 2026
## What does this PR do?

This adds a style system that hews as closely to CSS as possible. It is
not, and cannot be, CSS compliant, but where CSS styles provide an
answer, it uses it. It's fair to describe it as a _subset_ of CSS.

This CSS based system is completely decoupled from TTY styling and so
every property is explicitly mapped over. Included in this PR are styles
for display, flex direction, spacing, borders, and CSS colors.

<img width="470" height="236" alt="image"
src="https://github.com/user-attachments/assets/2d31eabd-cd4f-4300-a4e0-a3167cb6540d"
/>


Currently there are only default styles and inline styles of an element,
but we can later add style rules that match.


<img width="195" height="125" alt="image"
src="https://github.com/user-attachments/assets/478111c4-8a52-4001-a82f-e725e55f2919"
/>

The existing style cases now run directly from original WPT sources on
the native WPT base (#87). Relevant spec: CSSOM’s [CSSStyleDeclaration
interface](https://drafts.csswg.org/cssom/#the-cssstyledeclaration-interface).

This follows shared DOM lookup #70 in [the styling
stack](https://github.com/bombshell-dev/ui/stack/107). The focus stack
starting at #75 also depends on #70.

## Validation

- 267 workspace tests and 734 upstream WPT cases pass at the styling
stack tip.
- Build, lint, formatting, and WPT package typecheck pass.

## Type of change

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

## Checklist

- [x] I have added a changeset

## AI-generated code disclosure

- [x] This PR includes AI-generated code

I used AI to generate test cases, and occasionally suggest code
snippets.

Subsequent AI assistance also includes implementation, WPT adaptations,
validation, and PR splitting.
cowboyd added a commit that referenced this pull request Nov 23, 2026
## What does this PR do?

Apply element declarations to terminal output: default display modes,
inherited foreground colors, flex direction, gap, padding, and borders.
CSS color values are converted to TTY colors; traversal remains
iterative for deeply nested trees. Inline elements collect descendant
text using their outer style.

Restacked above the native WPT base (#87). Relevant specs: CSS Display’s
[display
property](https://drafts.csswg.org/css-display/#the-display-properties)
and CSS Flexbox’s [flex-direction
property](https://drafts.csswg.org/css-flexbox/#flex-direction-property).

## Type of change

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

## Checklist

- [x] I have added a changeset

## AI-generated code disclosure

- [x] This PR includes AI-generated code

AI disclosure: includes AI-assisted code, validation, and PR splitting.
cowboyd added a commit that referenced this pull request Nov 23, 2026
## What does this PR do?

Add a runnable basic panel built with DOM elements and inline styles. 

<img width="190" height="104" alt="image"
src="https://github.com/user-attachments/assets/9c26840a-eb44-4925-9fe8-f6e3a02f5210"
/>


Restacked above the native WPT base (#87); the example now uses the
required AbortSignal lifecycle.

## Type of change

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

## Checklist

- [x] I have added a changeset

## AI-generated code disclosure

- [x] This PR includes AI-generated code

AI disclosure: includes AI-assisted code, validation, and PR splitting.
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.

4 participants