Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFixed compilation errors in macros. Whitespace handling in Tree Builder. #205
Conversation
|
If you look at the spec, you'll see it tells to do exactly what we do: https://html.spec.whatwg.org/multipage/syntax.html#the-before-head-insertion-mode
|
|
What was the first commit for, btw? |
|
Oh, thanks, should’ve ran the tests :/ When I changed |
|
r? @nox |
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.
martinrlilja commentedApr 6, 2016
Hi!
I’m working on a project which uses html5ever and I noticed that the tree builder handles newlines and whitespace outside of the
bodyandheadtags in a slightly odd way.Take a simple document like this:
Currently html5ever ignores the newline and indentation of head. For example, the print-rcdom example yields this on the above document:
So I changed the
BeforeHeadrule intree_builder/rules.rsto treat text in the same wayAfterHeaddoes.(As a side note, doing so yielded some errors in the macros crate which I fixed. Those fixes are also part of this pr.)
So there is now a newline and indentation between the
htmlandheadtags. Perfect! But there are still two newlines inside the emptybodytag. (Both of them exists after the end tag of body.) I’m guessing they come from theAfterBodyrule. Which, I guess, is there in case there is text after the body. But it seems odd that it affects a valid document like this.So without knowing the spec, maybe only text up until the last non-whitespace character should be inserted into the body and the rest should be where it originally occurred in the input stream.
The output should then look like this:
Does this seem reasonable?
This change is