Skip to content

fix(parse/html/vue): don't treat : as special token outside of vue directives#9162

Merged
dyc3 merged 1 commit intomainfrom
dyc3/parse-attrs-w-colon-in-vue
Feb 20, 2026
Merged

fix(parse/html/vue): don't treat : as special token outside of vue directives#9162
dyc3 merged 1 commit intomainfrom
dyc3/parse-attrs-w-colon-in-vue

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Feb 20, 2026

Summary

This makes sure we only consider colons to be special if we know we are lexing a vue directive, in vue files.

partial fix for #9161

Test Plan

added snapshots, removed some invalid svelte syntax from a vue test

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: cc5a919

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor Author

dyc3 commented Feb 20, 2026

@github-actions github-actions bot added A-Parser Area: parser L-HTML Language: HTML and super languages labels Feb 20, 2026
@dyc3 dyc3 marked this pull request as ready for review February 20, 2026 18:27
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

This PR fixes Vue colon attribute parsing in the HTML parser by preventing colons from being consumed as part of identifiers when Vue directive prefixes (v-) are detected. The lexer now treats colon-prefixed attributes like xlink:href and xmlns:xlink as single attributes instead of splitting them into separate tokens. Changes include a new helper function to detect Vue directive prefixes, modifications to identifier consumption logic, and test cases validating correct parsing of namespaced and Attributify-style attributes.

Possibly related PRs

Suggested labels

D-Vue

Suggested reviewers

  • ematipico
  • chansuke
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: preventing colons from being treated as special tokens outside Vue directives in Vue file parsing.
Description check ✅ Passed The description clearly explains the motivation and what problem the PR solves—treating colons as special only in Vue directives, not universally.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/parse-attrs-w-colon-in-vue

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 20, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
🆕 60 new benchmarks
⏩ 152 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 synthetic/astro-components.astro[format] N/A 4.5 ms N/A
🆕 synthetic/vue-directives.vue[format] N/A 2.5 ms N/A
🆕 real/wikipedia-fr-Guerre_de_Canudos.html[format] N/A 1.4 s N/A
🆕 real/wikipedia-Unix.html[format] N/A 416 ms N/A
🆕 synthetic/comments.html[format] N/A 3 ms N/A
🆕 synthetic/attribute-heavy.html[format] N/A 3.6 ms N/A
🆕 synthetic/astro-expressions.astro[format] N/A 3.5 ms N/A
🆕 synthetic/vue-dynamic-args.vue[format] N/A 2.5 ms N/A
🆕 synthetic/svelte-expressions.svelte[format] N/A 2.1 ms N/A
🆕 synthetic/svelte-control-flow.svelte[format] N/A 1.7 ms N/A
🆕 synthetic/svelte-directives.svelte[format] N/A 1.8 ms N/A
🆕 synthetic/tables.html[format] N/A 10.2 ms N/A
🆕 real/wikipedia-JavaScript.html[format] N/A 498.8 ms N/A
🆕 synthetic/mixed-content.html[format] N/A 6.9 ms N/A
🆕 synthetic/svelte-snippets.svelte[format] N/A 3.4 ms N/A
🆕 synthetic/long-attribute-values.html[format] N/A 1.3 ms N/A
🆕 synthetic/vue-expressions.vue[format] N/A 2 ms N/A
🆕 synthetic/high-depth.html[format] N/A 2 ms N/A
🆕 synthetic/wide-siblings.html[format] N/A 8.3 ms N/A
🆕 synthetic/void-elements.html[format] N/A 5.8 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing dyc3/parse-attrs-w-colon-in-vue (cc5a919) with main (a794cd9)

Open in CodSpeed

Footnotes

  1. 152 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3
Copy link
Contributor Author

dyc3 commented Feb 20, 2026

Any idea why codspeed still thinks the benchmarks are new? @ematipico

@dyc3 dyc3 merged commit 7f1e060 into main Feb 20, 2026
19 checks passed
@dyc3 dyc3 deleted the dyc3/parse-attrs-w-colon-in-vue branch February 20, 2026 20:04
@github-actions github-actions bot mentioned this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants