dom: add document.children

This commit is contained in:
Pierre Tachoire
2023-12-12 15:24:01 +01:00
parent 6566df6338
commit 6f91537354
2 changed files with 43 additions and 0 deletions

View File

@@ -166,6 +166,13 @@ pub const Document = struct {
return try parser.documentCreateAttributeNS(self, ns, qname);
}
// ParentNode
// https://dom.spec.whatwg.org/#parentnode
pub fn get_children(self: *parser.Document) !collection.HTMLCollection {
const root = try parser.documentGetDocumentElement(self);
return try collection.HTMLCollectionChildren(parser.elementToNode(root), true);
}
pub fn deinit(_: *parser.Document, _: std.mem.Allocator) void {}
};