mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
make Node.isConnected() shadowroot-aware
This commit is contained in:
@@ -378,8 +378,14 @@ pub fn isConnected(self: *const Node) bool {
|
|||||||
root = parent;
|
root = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A node is connected if its root is a document
|
switch (root._type) {
|
||||||
return root._type == .document;
|
.document => return true,
|
||||||
|
.document_fragment => |df| {
|
||||||
|
const sr = df.is(ShadowRoot) orelse return false;
|
||||||
|
return sr._host.asNode().isConnected();
|
||||||
|
},
|
||||||
|
else => return false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const GetRootNodeOpts = struct {
|
const GetRootNodeOpts = struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user