Repository navigation
[html] fix validation error on JavaScript block comment (for #171153) - #240932
Merged
Merged
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
Martin Aeschlimann (aeschli)
approved these changes
May 21, 2026
Aiday Marlen Kyzy (aiday-mar)
previously approved these changes
May 21, 2026
Martin Aeschlimann (aeschli)
previously approved these changes
May 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes HTML validation errors caused by HTML-like markers in embedded JavaScript.
Changes:
- Replaces single-line HTML comments using a global regex.
- Adds embedded-content regression fixtures.
Show a summary per file
| File | Description |
|---|---|
embeddedSupport.ts |
Updates HTML-comment conversion logic. |
embedded.test.ts |
Adds block-comment and multiple-comment fixtures. |
Review details
Comments suppressed due to low confidence (1)
extensions/html-language-features/server/src/modes/embeddedSupport.ts:202
- This still corrupts valid JavaScript block comments when they contain a complete marker pair:
/* <!-- --> */becomes/* /* */ */, which produces the validation errors this fix is meant to avoid. Replacing each matched HTML-comment span with same-length whitespace (as suggested in the linked issue) avoids injecting nested delimiters and also preserves source positions; add this paired-marker regression case as well.
return content.replace(SingleLineHTMLComment, (_, p1: string) => {
return `/* ${p1} */`;
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Medium
roblourens
previously approved these changes
Jul 29, 2026
Don Jayamanne (DonJayamanne)
previously approved these changes
Jul 29, 2026
Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
dismissed stale reviews from Don Jayamanne (DonJayamanne), roblourens, Martin Aeschlimann (aeschli), and Aiday Marlen Kyzy (aiday-mar)
via
July 29, 2026 03:24
f5f3f1b
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 29, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
July 29, 2026 03:25
roblourens
approved these changes
Jul 29, 2026
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.
Fix #171153
gflag to replace all occurrence of patterns instead of just replace the first one. (As I comments: [html] validation error on JavaScript block comment with arrow in HTML script #171153 (comment))Actually, I wonder if it's right to do such thing in html-language-feature, since it's additional ECMAScript features for browsers. And here we can only do replacement based on raw text, so it's hard to implement some grammar in spec.