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 support for form owner #137

Closed
wants to merge 1 commit into from
Closed

Conversation

mukilan
Copy link
Member

@mukilan mukilan commented May 26, 2015

This is needed for servo/servo#3553.

Review on Reviewable

@Manishearth
Copy link
Member

\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));
Copy link
Member

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?

Copy link
Member Author

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?

@Manishearth
Copy link
Member

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) {
}
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

@Manishearth
Copy link
Member

Travis fails, btw.

@mukilan
Copy link
Member Author

mukilan commented May 29, 2015

Fixed build errors.

@metajack
Copy link
Contributor

@mukilan Did you address @SimonSapin comments as well?

@jdm jdm self-assigned this Jul 29, 2015
@jdm
Copy link
Member

jdm commented Jul 29, 2015

I agreed to look over these changes.

@bors-servo
Copy link
Contributor

☔ 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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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.

@hsivonen
Copy link

hsivonen commented Sep 9, 2015

@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.

@nox
Copy link
Contributor

nox commented Sep 13, 2015

@mukilan Is there really no way to keep insert_appropriately() as it is currently? I liked that it relied on inserting failing if there are no parent, instead of needing a has_parent_node() hook.

@nox nox added the web-compat label Sep 13, 2015
bors-servo pushed a commit that referenced this pull request Feb 6, 2017
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 -->
@canova
Copy link
Contributor

canova commented Feb 11, 2017

We can close this since it's implemented in #249

@canova canova closed this Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants