Skip to content

Compare exact case-sensitive attribute values directly - #200

Merged
jdalton merged 3 commits into
dperini:masterfrom
jdalton:perf/attribute-equality
Sep 7, 2026
Merged

Compare exact case-sensitive attribute values directly#200
jdalton merged 3 commits into
dperini:masterfrom
jdalton:perf/attribute-equality

Conversation

@jdalton

@jdalton jdalton commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Tooling update

Rebased onto merged #212 as one commit. Sources and tests use .mts, Node tests use Vitest, and the published JavaScript paths stay unchanged. The original engine changes are preserved.

Local lint, formatting, Node and packed-package checks pass. All 41 WPT pages pass against both generated builds.

Change

Compare exact, case-sensitive attribute values as strings instead of running a regular expression for each candidate. Case-insensitive matches and other operators keep their existing path.

Extracted from #167 without its legacy helpers or tag-ordering changes. The attribute name stays separate from the decoded value, fixing the aggregate's case-rule regression. Quoted values retain JavaScript escapes without double-escaping quotes.

Validation covers HTML case-insensitive attributes, custom data attributes, explicit i, empty and missing attributes, escaped values, XML, SVG, cached queries, and a custom operator. Compilation checks confirm the direct comparison is emitted. All three tests pass with Chromium enabled, including ten native-browser comparisons.

Run with Node.js ≥ 22. Commands are in test/attribute-equality.md. No end-to-end speedup is claimed without a benchmark.

@jdalton
jdalton force-pushed the perf/attribute-equality branch 2 times, most recently from aeda16b to b7d8726 Compare September 6, 2026 02:30
@jdalton
jdalton force-pushed the perf/attribute-equality branch from b7d8726 to c42d2ee Compare September 6, 2026 11:40
@jdalton

jdalton commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

Integrated the current legacy helpers and added WPT coverage for exact values, escapes, HTML/XML case rules, SVG, and custom operators. A new cross-document test exposed cached HTML case rules being reused for XML; the PR now invalidates document-specific plans when the document changes. All 470 Node tests and 52 WPT pages pass, and CI is green. Coverage thresholds are unchanged.

@jdalton
jdalton merged commit cc5ac92 into dperini:master Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant