diff options
Diffstat (limited to 'components/script/dom/treewalker.rs')
-rw-r--r-- | components/script/dom/treewalker.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/components/script/dom/treewalker.rs b/components/script/dom/treewalker.rs index de5219a608f..a11432a5d69 100644 --- a/components/script/dom/treewalker.rs +++ b/components/script/dom/treewalker.rs @@ -395,13 +395,9 @@ impl TreeWalker { None => { let mut candidate = DomRoot::from_ref(node); while !self.is_root_node(&candidate) && candidate.GetNextSibling().is_none() { - match candidate.GetParentNode() { - None => - // This can happen if the user set the current node to somewhere - // outside of the tree rooted at the original root. - return None, - Some(n) => candidate = n - } + // This can return None if the user set the current node to somewhere + // outside of the tree rooted at the original root. + candidate = candidate.GetParentNode()?; } if self.is_root_node(&candidate) { None |