Skip to content

Commit

Permalink
Node::GetParentElement should use and_then instead of filtered/map.
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuharuohzeki committed May 2, 2014
1 parent b36b779 commit 31cf10c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/components/script/dom/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31cf10c

Please sign in to comment.