Skip to content

Handle attribute string errors and escaped line continuations - #198

Merged
jdalton merged 1 commit into
dperini:masterfrom
jdalton:fix/attribute-parse-error
Sep 6, 2026
Merged

Handle attribute string errors and escaped line continuations#198
jdalton merged 1 commit into
dperini:masterfrom
jdalton:fix/attribute-parse-error

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

Handle failed attribute matches through the normal syntax-error path and support escaped line continuations in quoted strings.

This follows the end-of-input discussion on #179. A backslash followed by LF, CR, CRLF or form feed continues a CSS string. A raw newline does not.

The parser consumes continuations before whitespace normalization, preserves hex-escape boundaries, and keeps valid end-of-input recovery. It rejects raw newlines, including form feed and a newline at the end of an unclosed string. Tag-prefixed match() calls no longer silently lose the invalid suffix.

The four former TODO cases are now ordinary passing tests. Validation:

  • 163 attribute tests, four runtime tests and 11 adapter tests pass with jsdom 30.0.1. No TODOs or skips.
  • 155 cases agree with Chromium 151.0.7922.34 for selection, first-match lookup and matching, on initial and cached calls.
  • All 41 selected WPT pages pass with Add pinned WPT and isolated Node test tooling #167's baseline unchanged.

Run pnpm run test:attributes. For native-browser comparison, install Chromium and run pnpm run test:attributes:browser. See test/attribute-parse-error.md for details. One commit.

@jdalton
jdalton force-pushed the fix/attribute-parse-error branch from 8b58bf6 to f65d449 Compare September 5, 2026 16:13
@jdalton
jdalton force-pushed the fix/attribute-parse-error branch from f65d449 to a6dbae3 Compare September 5, 2026 22:55
@jdalton jdalton changed the title Report invalid attribute matches as syntax errors Handle attribute string errors and escaped line continuations Sep 5, 2026
@jdalton jdalton added the bug label Sep 5, 2026
@jdalton
jdalton force-pushed the fix/attribute-parse-error branch 2 times, most recently from 0f39244 to c4b0eb3 Compare September 6, 2026 02:30
@jdalton
jdalton force-pushed the fix/attribute-parse-error branch from c4b0eb3 to 3c512c7 Compare September 6, 2026 03:02
@jdalton
jdalton merged commit d39f176 into dperini:master Sep 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant