Repository navigation
fix: space single-quoted HTML attribute values - #347
Open
Omair-Asdaq wants to merge 1 commit into
Open
Omair-Asdaq wants to merge 1 commit into
Omair-Asdaq wants to merge 1 commit into
Conversation
Attribute value spacing matched only double-quoted values, so `<input value='測試123'>` stayed tight while the double-quoted form became `<input value="測試 123">`. Match either quote style and preserve the original delimiter. Add regression cases to the angle-bracket suite.
Omair-Asdaq
marked this pull request as ready for review
November 7, 2026 00:22
This branch has not been deployed
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.
Problem
spaceTextspaces the text inside HTML attribute values, but the attribute matcher only accepted double-quoted values. A single-quoted value stayed tight while its double-quoted twin was spaced:CONTEXT.mdanddocs/adr/0005-bare-unpaired-tags-read-as-mentions.mdboth say attribute values are spaced, without qualifying the quote style.Change
The attribute matcher now accepts either quote style and preserves the original delimiter:
The value still goes through
spaceText; only the single-quoted path changes. The double-quoted path is byte-identical: 4,003 apostrophe-free inputs, 3,360 double-quoted shapes, and a Private Use Area sweep produced no differences.Test evidence
space single-quoted attribute valuesintests/shared/symbol-angle-brackets.test.ts.expected '<input value=\'測試123\'>' to be '<input value=\'測試 123\'>'. With the fix it passes; the other cases stay green.value='say "測試123"') catches a looser mutant that stops the value at either quote character; the shipped regex passes it.npx vitest run tests/: 57 files, 445 passed, 6 expected fail, 0 failed.npx vitest run browser-extensions/chrome/tests/: 10 files, 221 passed.npx tsc --noEmit -p tsconfig.json: clean.npx eslint src/shared/index.ts tests/shared/symbol-angle-brackets.test.ts: clean.npx prettier --check ...: clean.npm run build/test:sharedchains use Unixrm -rf; I ran the equivalentnpm run build:lib, the extension vite build, and vitest directly.Boundary shapes
<input value="測試123">測試 123<input value='測試123'>測試123測試 123<input value=''>/value=""<input value="a'b">/value='a"b'<input value='測試123' data-title='A中文'>A 6,943-input differential matrix produced 212 differences, all inside single-quoted attribute values, with no removed spaces or structural changes. 3,360/3,360 single-vs-double pairs match after normalizing the delimiter; idempotency had 0 violations; a 5,000-input fuzz had 0 throws and 0 unintended differences.
Known limitations
title=測試123), whitespace around=, and a literal>inside a quoted value still follow the existing tag matcher; this PR does not change them.&reading (for example ) is unchanged; that behavior predates this PR and needs its own decision.hasProperSpacing/pangu -c: an HTML source with<input value='測試123'>that previously exited 0 now reports it as needing correction (exit 1), which is the intended contract.name='value', so the shared string path is the only affected consumer.Claim check
No open issue or PR covers this; the repository had 0 open PRs. Prior commits
7a86527(URL protection) and266d6e8(double-quoted attribute values) were inspected; the repro still fails on HEAD, so this is a residual single-quote gap rather than a fixed defect. Evidence:repo-repair-work/vinta-pangu.js-claim.md.