mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
dom: remove unreachable from html collection
This commit is contained in:
@@ -47,14 +47,21 @@ pub const HTMLCollection = struct {
|
||||
}
|
||||
|
||||
// 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
|
||||
var lastchild = parser.nodeLastChild(parent);
|
||||
var prev = cur;
|
||||
while (prev != root and prev == lastchild) {
|
||||
prev = 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
|
||||
lastchild = parser.nodeLastChild(parent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user