Skip to content

Batch parsing of inline scripts/stylesheets #626

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MegaCorn
Copy link

Before: html5ever produces tokens for each line of inline content
After: html5ever batchs inline contents until encounter '<', which represents endtag in most cases
Fixes: servo/servo#34502

@simonwuelker
Copy link
Contributor

html5ever emits the line number for each token it parses. I this change will break the line counting, because we no longer hit

if c == '\n' {
self.current_line.set(self.current_line.get() + 1);
}
for each newline in the input data. That's probably why we interrupt the tokenizer when we see a newline in the first place.

I'd like to get rid of the line count at some point, because it also has a significant performance overhead in other places (#601 (comment)), but I have not investigated the implications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTML parser parses inline scripts/stylesheets line by line
2 participants