mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
dom: remove unreachable from html collection
This commit is contained in:
@@ -47,14 +47,21 @@ pub const HTMLCollection = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO deinit parent
|
// TODO deinit parent
|
||||||
var parent = parser.nodeParentNode(cur) orelse unreachable;
|
// Back to the parent of cur.
|
||||||
|
// If cur has no parent, then the iteration is over.
|
||||||
|
var parent = parser.nodeParentNode(cur) orelse return null;
|
||||||
|
|
||||||
// TODO deinit lastchild
|
// TODO deinit lastchild
|
||||||
var lastchild = parser.nodeLastChild(parent);
|
var lastchild = parser.nodeLastChild(parent);
|
||||||
var prev = cur;
|
var prev = cur;
|
||||||
while (prev != root and prev == lastchild) {
|
while (prev != root and prev == lastchild) {
|
||||||
prev = parent;
|
prev = parent;
|
||||||
|
|
||||||
// TODO deinit parent
|
// TODO deinit parent
|
||||||
parent = parser.nodeParentNode(cur) orelse unreachable;
|
// Back to the prev's parent.
|
||||||
|
// If prev has no parent, then the loop must stop.
|
||||||
|
parent = parser.nodeParentNode(cur) orelse break;
|
||||||
|
|
||||||
// TODO deinit lastchild
|
// TODO deinit lastchild
|
||||||
lastchild = parser.nodeLastChild(parent);
|
lastchild = parser.nodeLastChild(parent);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user