Node::GetParentElement should use and_then instead of filtered/map.

This commit is contained in:
Tetsuharu OHZEKI 2014-05-02 13:13:06 +09:00
parent b36b779d24
commit 31cf10c006

View file

@ -902,9 +902,7 @@ impl Node {
// http://dom.spec.whatwg.org/#dom-node-parentelement
pub fn GetParentElement(&self) -> Option<JS<Element>> {
self.parent_node.clone()
.filtered(|parent| parent.is_element())
.map(|node| ElementCast::to(&node).unwrap())
self.parent_node.clone().and_then(|parent| ElementCast::to(&parent))
}
// http://dom.spec.whatwg.org/#dom-node-haschildnodes