diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-10-31 10:25:44 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-10-31 10:25:44 +0100 |
commit | bd547dee5ea6b12e6e9a2563bd25c32f17fdae5c (patch) | |
tree | 75744318e6956dd3f24471201666938201a3174f /components/script/dom | |
parent | 7de9ed5fc7a3061676d9fd02dfc788e196c7123c (diff) | |
download | servo-bd547dee5ea6b12e6e9a2563bd25c32f17fdae5c.tar.gz servo-bd547dee5ea6b12e6e9a2563bd25c32f17fdae5c.zip |
Cleanup the implementation of HTMLTableElement::GetCaption.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/htmltableelement.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index b39c8ebb3e3..7dddf98bdc4 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -9,7 +9,6 @@ use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::js::{JSRef, Temporary}; use dom::bindings::utils::{Reflectable, Reflector}; use dom::document::Document; -use dom::element::HTMLTableCaptionElementTypeId; use dom::element::HTMLTableElementTypeId; use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::htmlelement::HTMLElement; @@ -52,11 +51,10 @@ impl<'a> HTMLTableElementMethods for JSRef<'a, HTMLTableElement> { // http://www.whatwg.org/html/#dom-table-caption fn GetCaption(self) -> Option<Temporary<HTMLTableCaptionElement>> { let node: JSRef<Node> = NodeCast::from_ref(self); - node.children().find(|child| { - child.type_id() == ElementNodeTypeId(HTMLTableCaptionElementTypeId) - }).map(|node| { - Temporary::from_rooted(HTMLTableCaptionElementCast::to_ref(node).unwrap()) - }) + node.children() + .filter_map::<JSRef<HTMLTableCaptionElement>>(HTMLTableCaptionElementCast::to_ref) + .next() + .map(Temporary::from_rooted) } // http://www.whatwg.org/html/#dom-table-caption |