Repository navigation
Conversation
…ence The named character reference state read each character with get_char(), which turns CR into LF and sets the flag that skips the LF of a CR LF pair. A CR right after the reference was read this way and given back to the input as LF, so the next read skipped it and "<\ry" became "<y". Read the name with peek() and discard_char() instead, and make discard_char() drop one raw input character, as html5ever's tokenizer already does. Signed-off-by: joszamama <joszamama@gmail.com>
Member
|
@joszamama When you say that you used AI to help do you mean that it generated the code? |
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.
In xml5ever, a CR right after a named character reference was dropped:
<a><CRy</a>gave"<y"instead of"<\ny".do_namedread the next character withget_char, which turns CR into LF and setsignore_lf, so the LF that was pushed back got skipped on the next read.This ports the html5ever fix from #460:
do_namedusespeekanddiscard_char, anddiscard_chardrops one raw input character. The other callers ofdiscard_charalready pair it withpeek.Fixes #816
Testing: the new unit test
carriage_return_after_char_reffails without the change and passes with it.cargo test --all(with both test submodules) passes on main with 29529 tests and on this branch with 29530, andcargo fmt --all -- --checkis clean.As said in the issue, I used AI to help draft this patch and text, and I checked that I understand the change. Feel free to use it or close it.