Do not panic on navigating across documents

This commit is contained in:
Utsav Oza 2020-07-30 16:31:36 +05:30
parent da45522085
commit 962e620529
3 changed files with 12 additions and 8 deletions

View file

@ -708,16 +708,16 @@ impl Node {
&self,
other: &Node,
shadow_including: ShadowIncluding,
) -> DomRoot<Node> {
) -> Option<DomRoot<Node>> {
for ancestor in self.inclusive_ancestors(shadow_including) {
if other
.inclusive_ancestors(shadow_including)
.any(|node| node == ancestor)
{
return ancestor;
return Some(ancestor);
}
}
unreachable!();
None
}
pub fn is_inclusive_ancestor_of(&self, parent: &Node) -> bool {