Skip to content

Commit 8227098

Browse files
committed
Isolate relative anchors from public selectors and update regression coverage
2 parents 2a3fbae + 63c05fb commit 8227098

100 files changed

Lines changed: 2270 additions & 492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.config/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Code style
22

33
Run `pnpm format`, `pnpm lint`, and `pnpm type` before submitting changes.
4-
Formatting and linting share their file list in `scripts/lib/tooling-scope.mts`.
4+
Formatting and linting share their file list in `scripts/repo/lib/tooling-scope.mts`.
55
Generated JavaScript and upstream fixtures are excluded.
66

77
Use two spaces, single quotes, no semicolons, and regex literals for static
88
patterns. Lint checks correctness, suspicious code, imports, and TypeScript.
99
Use default imports for `node:path`, `node:crypto`, and `node:os`.
1010

11-
Package scripts use `scripts/run.mts` to share an OS-temporary Node compile cache
11+
Package scripts use `scripts/repo/run.mts` to share an OS-temporary Node compile cache
1212
with child processes. Existing cache settings and opt-outs are preserved.
1313
Coverage runs disable the cache for accurate measurements.
1414
The launcher permits pnpm, aube, and direct Node runs. Other package managers

‎.config/generated.d.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,22 @@ declare module '*/src/nwsapi.js' {
44
const factory: (host: { document: Document }) => typeof NW.Dom
55
export default factory
66
}
7+
8+
declare module '*/src/dom-selector.js' {
9+
export default class DOMSelector {
10+
constructor(window: unknown, document?: unknown, options?: unknown)
11+
static configure(window: unknown, options: Record<string, boolean>): void
12+
static use(window: unknown, engine: unknown): unknown
13+
engine: unknown
14+
selectors: Map<string, unknown>
15+
matches(
16+
selector: string,
17+
node: unknown,
18+
options?: { noexcept?: boolean },
19+
): boolean
20+
closest(selector: string, node: unknown): unknown
21+
querySelector(selector: string, node: unknown): unknown
22+
querySelectorAll(selector: string, node: unknown): unknown[]
23+
clear(clearAll?: boolean): void
24+
}
25+
}

‎.config/playwright.config.mts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import process from 'node:process'
22
import { fileURLToPath } from 'node:url'
33
import { defineConfig } from '@playwright/test'
4+
import { isAgent } from '../scripts/repo/lib/is-agent.mts'
45

56
// Vitest runs Node tests; this configuration only runs WPT in Chromium.
67
export default defineConfig({
7-
testDir: '../test/upstream',
8+
testDir: '../test/repo/e2e/upstream',
89
outputDir: '../test-results',
910
testMatch: 'wpt.spec.mts',
1011
fullyParallel: true,
1112
workers: process.env.WPT_UPDATE_EXPECTATIONS ? 1 : 4,
12-
reporter: 'list',
13+
reporter: isAgent() ? 'dot' : 'list',
1314
timeout: 90_000,
1415
use: { baseURL: 'http://127.0.0.1:8000', browserName: 'chromium' },
1516
webServer: {
1617
cwd: fileURLToPath(new URL('../', import.meta.url)),
17-
command: 'node scripts/serve.mts',
18+
command: 'node scripts/repo/serve.mts',
1819
url: 'http://127.0.0.1:8000/resources/testharness.js',
1920
reuseExistingServer: false,
2021
env: { ...process.env, PORT: '8000' },

‎.config/tsconfig.check.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
},
1717
"include": [
1818
"../src/**/*.mts",
19-
"../scripts/**/*.mts",
20-
"../test/*.mts",
21-
"../test/upstream/*.mts",
19+
"../scripts/repo/**/*.mts",
20+
"../test/repo/**/*.mts",
2221
"./*.mts",
2322
"./*.d.ts"
2423
]

‎.config/vitest.config.mts‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
import { defineConfig } from 'vitest/config'
22
import { fileURLToPath } from 'node:url'
3+
import { isAgent } from '../scripts/repo/lib/is-agent.mts'
34

45
process.env.TZ ??= 'UTC'
56

67
export default defineConfig({
78
server: { watch: { usePolling: process.env.CHOKIDAR_USEPOLLING === '1' } },
89
test: {
10+
reporters: isAgent()
11+
? [
12+
'minimal',
13+
...(process.env.GITHUB_ACTIONS === 'true'
14+
? ['github-actions' as const]
15+
: []),
16+
]
17+
: undefined,
918
watch: process.argv.includes('--watch'),
10-
include: ['test/*.test.mts'],
19+
include: ['test/repo/**/*.test.mts'],
1120
globalSetup: ['.config/vitest.setup.mts'],
12-
forceRerunTriggers: ['../src/**/*.mts', '../scripts/build.mts', './**'].map(
13-
path => fileURLToPath(new URL(path, import.meta.url)),
14-
),
21+
forceRerunTriggers: [
22+
'../src/**/*.mts',
23+
'../scripts/repo/build.mts',
24+
'./**',
25+
].map(path => fileURLToPath(new URL(path, import.meta.url))),
1526
environment: 'node',
1627
pool: 'forks',
1728
isolate: true,

‎.config/vitest.setup.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { TestProject } from 'vitest/node'
44

55
export default function setup(project: TestProject) {
66
const build = () => {
7-
execFileSync(process.execPath, ['scripts/build.mts'], {
7+
execFileSync(process.execPath, ['scripts/repo/build.mts'], {
88
cwd: new URL('../', import.meta.url),
99
stdio: 'inherit',
1010
})

‎.github/workflows/node.js.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 (2026-07-20)
1414
- id: tools
15-
run: node scripts/external-tools.mts --github-output
15+
run: node scripts/repo/external-tools.mts --github-output
1616
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 (2026-07-14)
1717
with:
1818
node-version: ${{ steps.tools.outputs.node }}

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ See the [full API reference](docs/api.md) for all methods, options, and adapter
124124
- [Configure the engine](docs/api.md#configuration) with `configure()`.
125125
- [Use the jsdom adapter](docs/api.md#jsdom-adapter) for queries and stylesheet matching.
126126

127-
> [!IMPORTANT]
128-
> Set `LEGACY` before the first query when the environment needs compatibility fallbacks.
127+
<blockquote>
128+
<p><img src="assets/repo/important.svg" width="16" height="16" alt=""> <strong>Important</strong></p>
129+
<p>Set <code>LEGACY</code> before the first query when the environment needs compatibility fallbacks.</p>
130+
</blockquote>
129131

130132
</details>
131133

‎assets/repo/important.LICENSE‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
GitHub Octicons report-16 icon
2+
https://github.com/primer/octicons
3+
4+
MIT License
5+
6+
Copyright (c) 2026 GitHub Inc.
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.

‎assets/repo/important.svg‎

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)