Add Selectors 4 state pseudo-classes, upstream WPT runner, modern toolchain - #167
Open
jdalton wants to merge 1 commit into
Open
Add Selectors 4 state pseudo-classes, upstream WPT runner, modern toolchain#167jdalton wants to merge 1 commit into
jdalton wants to merge 1 commit into
Conversation
…lchain - src/nwsapi.js: wire :open, :modal, :fullscreen, :picture-in-picture and the time-dimensional :current/:past/:future (valid, never matching per Selectors Level 5); treat :closed as a parse error (removed by CSSWG, dropped in Chrome 122); fix isInstanceOf typo, expose isPlaying on the Snapshot, scope media-state pseudo-classes to media elements - upstream/wpt: sparse+shallow+blob:none web-platform-tests checkout pinned in .gitmodules (gitlink-less; ref is the pin of record; ls-tree manifest sha256) with dependency-free scripts/git-partial-submodule.mjs (clone / verify / verify --deep / restore-sparse, argv-hardened) - test/upstream: Playwright runner over 41 WPT files plus state-pseudo browser tests (47 tests, 375-entry expectations baseline), filterable by individual selector (WPT_FILTER) or spec section (WPT_SECTION) - bench: legacy test/speed Benchmark.js presets (9 groups, 201 selectors) ported verbatim to mitata under node + jsdom with --preset/--selector - toolchain: pnpm 11.18.0 pinned with exact deps and node >=24 (engineStrict/saveExact in pnpm-workspace.yaml), eslint 10 flat config, node build scripts (terser min, clean), rewritten GitHub Actions workflow, portless (vercel-labs) for https://nwsapi.localhost serving - README: repair corrupted sponsorship-commit fragments; document the new pseudo-classes, the :closed decision, and the development workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the Selectors 4 state pseudo-classes, a runner that checks nwsapi against the real web-platform-tests suite, and a toolchain refresh.
Four parts, in the order they matter:
src/nwsapi.js:open,:modal,:fullscreen,:picture-in-picture, and the time-dimensional:current/:past/:futuretest/upstreambenchtest/speedBenchmark.js presets ported to mitata, 9 groups and 201 selectorsThis is a large diff because the test runner and the toolchain came along with the selector work. If you would rather review the selector changes on their own, say so and I will split the runner and the toolchain into follow-ups.
The selector changes - which pseudo-classes landed, and why
:closedis absent on purposeThe state pseudo-classes are wired against the elements that can actually carry the state, so
:modaland:fullscreendo not match arbitrary nodes. The media-state pseudo-classes are scoped to media elements for the same reason, andisPlayingis exposed on the Snapshot so the check has something to read.:current,:past, and:futureparse as valid and never match. Selectors Level 5 defines them for time-dimensional documents, and a library with no timing model has nothing to match them against, so accepting them without matching is the behavior the spec asks for.:closedis deliberately not implemented, which makes it a parse error. The CSSWG removed it and Chrome dropped it in 122, so treating it as valid would mean matching something no browser matches.Two smaller fixes ride along: an
isInstanceOftypo, and the README's sponsorship section, which had corrupted commit fragments in it.How the WPT runner works - a pinned sparse checkout, and no gitlink
The suite comes from a sparse, shallow,
blob:noneweb-platform-tests checkout pinned in.gitmodules. There is no gitlink committed. Therefis the pin of record, alongside anls-treemanifest sha256, so the pin is reviewable as text rather than as an opaque commit id.scripts/git-partial-submodule.mjsdrives it with no dependencies and supportsclone,verify,verify --deep, andrestore-sparse. Its argv handling is hardened, since it shells out to git.The runner is filterable while you work on one thing:
WPT_FILTERnarrows to an individual selector andWPT_SECTIONnarrows to a spec section. The expectations file records the current state so a change in results shows up as a diff rather than as a wall of failures.Toolchain details - what to run, and what changed underneath
pnpm is pinned at 11.18.0 through
packageManager, withengineStrictandsaveExactset inpnpm-workspace.yamlso dependency versions stay exact.engines.nodeis>= 24.The build scripts are plain node: terser for the minified build, and a clean script. eslint moves to 10 with a flat config. The Actions workflow is rewritten against the above.
For local serving over https,
portlessfrom vercel-labs serves the pages athttps://nwsapi.localhost, which is what the browser tests point at.