-
Notifications
You must be signed in to change notification settings - Fork 234
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 support for form owner #137
Conversation
\o/ ITS HAPPENING! |
@@ -230,8 +241,9 @@ impl TreeSink for Sink { | |||
|
|||
fn append_before_sibling(&mut self, | |||
sibling: Handle, | |||
child: NodeOrText<Handle>) -> Result<(), NodeOrText<Handle>> { | |||
let (mut parent, i) = unwrap_or_return!(get_parent_and_index(sibling), Err(child)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should avoid crashing here or document the panicky behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment in the trait definition documents the fact that append_before_sibling will only be called when has_parent(sibling) is true and hence it should never fail. Is this not enough?
r? @kmcallister (I'll go through this anyway, but I'm not nearly familiar with parsing to sign off on it) |
} | ||
|
||
fn associate_with_form(&mut self, _target: Handle, _form: Handle) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this (and same_home_subtree
?) be a default implementation in the trait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this because I thought owned_dom and rc_dom were just examples and don't implement all features (form owner support in this case). For real clients wouldn't we want to enforce the implementation of form owners? Or is it optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be useful to parse HTML in a "real" application that is not a browser doesn't support form submission.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I'll change them to be default implementations.
Travis fails, btw. |
Fixed build errors. |
@mukilan Did you address @SimonSapin comments as well? |
I agreed to look over these changes. |
☔ The latest upstream changes (presumably #151) made this pull request unmergeable. Please resolve the merge conflicts. |
Some((idx, last_table)) => { | ||
// Try inserting "inside last table's parent node, immediately before last table" | ||
if self.sink.has_parent_node(last_table.clone()) { | ||
BeforeSibling(last_table.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've lost the fallback behaviour from https://github.com/servo/html5ever/pull/137/files#diff-3f339094e126866dfc7763b9a1d54beaL232, haven't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I've read the other comments and I understand why this change is appropriate.
@mukilan, I'm not sure. It seems to me that @Hixie found it more convenient to handle parser-specific stuff in the parser's "create an element for a token" and to stipulate an exception to the insertion algorithm than to define parser-specific stuff in the insertion algorithm itself. There could be another reason that I fail to see, though. |
@mukilan Is there really no way to keep |
Implement support for form owner This is rebased version of #137. Fixed merge conflicts, updated to current codebase and addressed some comments. But there are still some todo's needs to be addressed. Servo side of this changes is currently WIP. Opening this for early feedbacks. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/html5ever/249) <!-- Reviewable:end -->
We can close this since it's implemented in #249 |
This is needed for servo/servo#3553.