-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Fix CSS errors when using HTML escaped quotes #235367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I will add another test to confirm this expectation.
youneshenniwrites
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏼
|
Thanks @iamdereky ! Nice work! |
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.