aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout_2020/dom_traversal.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs
index 5ccf8310d53..9d8f54f057e 100644
--- a/components/layout_2020/dom_traversal.rs
+++ b/components/layout_2020/dom_traversal.rs
@@ -426,8 +426,13 @@ where
node = child;
continue;
}
+ } else if node == self {
+ // If this is the root of the subtree and we aren't descending
+ // into our children return now.
+ return;
}
}
+
let mut next_is_a_sibling_of = node;
node = loop {
if let Some(sibling) = next_is_a_sibling_of.next_sibling() {