mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Hold a Temporary in AncestorIterator
This commit is contained in:
parent
6a6ecb9afa
commit
bf7c791e3a
10 changed files with 91 additions and 63 deletions
|
@ -258,7 +258,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
|||
if child.get_disabled_state() {
|
||||
return None;
|
||||
}
|
||||
if child.ancestors().any(|a| a.type_id() == NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement))) {
|
||||
if child.ancestors().any(|a| a.root().r().type_id() == NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement))) {
|
||||
return None;
|
||||
}
|
||||
// XXXManishearth don't include it if it is a button but not the submitter
|
||||
|
@ -531,8 +531,13 @@ pub trait FormControl<'a> : Copy + Sized {
|
|||
}
|
||||
}
|
||||
let node: JSRef<Node> = NodeCast::from_ref(elem);
|
||||
node.ancestors().filter_map(|a| HTMLFormElementCast::to_ref(a)).next()
|
||||
.map(Temporary::from_rooted)
|
||||
for ancestor in node.ancestors() {
|
||||
let ancestor = ancestor.root();
|
||||
if let Some(ancestor) = HTMLFormElementCast::to_ref(ancestor.r()) {
|
||||
return Some(Temporary::from_rooted(ancestor))
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn get_form_attribute<InputFn, OwnerFn>(self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue