Fix CSS errors when using HTML escaped quotes#235367
Merged
aeschli merged 3 commits intomicrosoft:mainfrom Dec 9, 2024
Merged
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
| assertEmbeddedLanguageContent('<div onKeyUp=return\n/><script>foo();</script>', 'javascript', ' return;\n foo(); '); | ||
| }); | ||
|
|
||
| test('Script content - HTML escape characters', function (): any { |
There was a problem hiding this comment.
What happens if the input doesn’t contain any escaped quotes? It might be worth adding a test to confirm the input is returned unmodified.
Contributor
Author
There was a problem hiding this comment.
Thanks for the feedback! I will add another test to confirm this expectation.
aeschli
approved these changes
Dec 6, 2024
Contributor
|
Thanks @iamdereky ! Nice work! |
aiday-mar
approved these changes
Dec 6, 2024
songjianet
approved these changes
Dec 8, 2024
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #228060
Description: When using HTML escaped quotes for style attributes in an HTML file, the CSS region no longer throws an error. While the escaped quote is still displayed in the original document, the extension now embeds the escaped quote as a quotation mark with additional spaces to maintain the embedded document's one-to-one requirement with the original document. Changes were also made to ensure that hovering over the CSS region will highlight the entire region (including the HTML escaped quotes).
Testing: Unit tests were created to ensure the CSS region of an HTML document would be embedded appropriately based on the changes. An HTML file containing tags with style attributes and HTML escaped quotes was also made in the build to test the changes. Along with the lack of errors, clicking and hovering over the CSS region in the style attribute verifies the expected behavior.