-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 Element.innerHTML setter #849
Comments
@jaeminMoon Just work on the getter to start with: http://mxr.mozilla.org/servo/source/src/components/script/dom/element.rs#364 . https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML |
For the setter, we should make hubbub_html_parser::parse_html (http://mxr.mozilla.org/servo/source/src/components/script/html/hubbub_html_parser.rs#248) take a root node argument instead of creating an HTMLHtmlElement node by default. |
Does anyone start to work this? |
Yes, @jaeminMoon is working on it. |
It's not just taking a root node argument. To get correct behavior you have to set up the parsing context based on the target node, then parse into a DocumentFragment, then replace the node's kids with the fragment. In particular, parsing into the DocumentFragment can throw, and in that case the node's kids should not be affected, which is pretty hard to do if you're parsing directly into the node. |
Is "parsing context" a spec concept I should be familiar with? |
@Adenilson is working on this. |
So the game plan: refactor parse_html() to be more modular and decoupled, targeting to reuse the code while receiving a DOMString in innerHTML. Restrictions: allow the code to be upgraded when the new HTML parser lands. There are really 3 steps on it: |
Move Parser creation to its own function (issue #849).
…SourceBuffer-abort Tests for SourceBuffer#abort()
Further notes for the benefits of NCSU students who may be working on this (@Adenilson, please talk to me before continuing to work on this):
(note, adapted from http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#html-fragment-parsing-algorithm) |
I'm not convinced this won't require a lot of rewriting when we land the new HTML parser. |
@jdm Sure, when I resume work on this, I will be coordinating with you guys. @Ms2ger yes and no... Let me explain it better. I didn't pursued this in part because I was hoping that the new parser would land soon. That being said, the new parser will need to support the user case i.e. receive a Node (as also a Document), and by having the interfaces available would be a matter of swapping the Hubbub based parser for the new one. |
The new parser will land shortly after the next Rust upgrade. It's designed to handle fragment parsing, but there are a few pieces missing; see kmcallister/html5ever#16. |
Well, I do have partial fragment parsing implemented right now, if you want me to publish that. Needs a few changes to html5ever though, so I would prefer to do it immediately after a rustup, unless someone wants to help me with backporting changes, or applying them directly to servo's branch. Well, I've decided to push what I have so far (cc @cparis): html5ever and servo. |
Ah, I see your changes to html5ever are quite small. You can go ahead and submit that as a PR against master. Then we'll reset branch servo to master, and revert rustup patches from master as necessary. |
This addresses #849. This PR cannot land until the corresponding PR (servo/html5ever#91) in html5ever lands. I've done some simple testing of this code, but I don't consider it thorougly tested yet. I wanted to start getting feedback about the overall design before I spend more time polishing the details, and testing.
This is fixed by #4888 \o/ |
Needed for #841.
The text was updated successfully, but these errors were encountered: