-
Notifications
You must be signed in to change notification settings - Fork 213
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
Implement "adoption agency algorithm" and "reconstruct the active formatting elements" #77
Merged
Conversation
This file contains 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
I guess CI won't go green until we rustup again. 😒 |
I'm working on the rustup and on reviewing this :) |
Needs a rebase. |
This is useful for debugging parsing of misnested markup.
We don't make use of this yet, but will for the adoption agency algorithm.
This is extracted from TreeBuilder::step, and will be reused by the adoption agency algorithm.
This is a fairly straightforward and naive implementation that probably has a lot of room for optimization. But it seems to match the spec's intended behavior and passes a bunch of tests. Implementing this exposed a bug in our handling of misnested <a> tags: we were recording indices of <a> nodes in the list of active formatting elements before running the adoption agency algorithm, then expecting them still to be valid afterward. But the adoption agency algorithm can mutate the list of active formatting elements, so we can't rely on the indices anymore. Furthermore, the spec says that only a single <a> node should be removed, which we now obey.
This fixes a number of html5lib tests and breaks a few others (which I believe rely on the adoption agency algorithm).
This fixes a few html5lib tests.
8c4863d
to
7e5d844
Compare
Rebased and fixed lines >100 characters. |
kmcallister
added a commit
that referenced
this pull request
Feb 2, 2015
Implement "adoption agency algorithm" and "reconstruct the active formatting elements"
Thanks, this is great :) |
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.
Fixes #15 (and a bunch of html5lib tests). See the individual commit messages for more details.
I'm very new to Rust so don't hold back; I'm sure I've made a bunch of mistakes. This implementation is also pretty naive and straightforward. I imagine it can be sped up quite a bit.