Skip to content
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
merged 6 commits into from
Feb 2, 2015

Conversation

aroben
Copy link
Contributor

@aroben aroben commented Jan 30, 2015

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.

@aroben
Copy link
Contributor Author

aroben commented Jan 30, 2015

I guess CI won't go green until we rustup again. 😒

@kmcallister
Copy link
Contributor

I'm working on the rustup and on reviewing this :)

@kmcallister
Copy link
Contributor

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.
@aroben
Copy link
Contributor Author

aroben commented Feb 2, 2015

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"
@kmcallister kmcallister merged commit 2e0634c into servo:master Feb 2, 2015
@kmcallister
Copy link
Contributor

Thanks, this is great :)

@aroben aroben deleted the adoption-agency branch February 2, 2015 23:14
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.

Implement the rest of misnested tag recovery
2 participants