Repository navigation
Conversation
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.
Attribute values are decoded with
decodeHTML, the rules for text content. Inside attributes, HTML handles legacy references without a;differently: if the reference is consumed as part of an attribute, isn't terminated by;, and the next character is=or an ASCII alphanumeric, it is left as-is. This mostly matters for URLs with query strings:Browsers return the value after the change. I checked the new test markup with
getAttribute()in Chrome, and all values match.entities(already a dependency,^8.0.0) hasdecodeHTMLAttributefor this.attrs,attributesand theattrscache update insetAttributenow use it. Text content still usesdecodeHTML, so<p>©x</p>remains©x.Tests:
test/tests/attribute-entities.js. The two assertions about the attribute rule fail without the change, and the other two check that complete references in attributes and text content still decode.TEST_TARGET=dist mocha --recursive ./test/testshas 309 passing. The 2Module Importfailures happen with and without the change in my environment (nobun). I built withnpx tsdown, andeslint src/nodes/html.tspasses.