mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Node::GetParentElement should use and_then instead of filtered/map.
This commit is contained in:
parent
b36b779d24
commit
31cf10c006
1 changed files with 1 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue