dom: implement getElementsByClassName

This commit is contained in:
Pierre Tachoire
2023-11-17 17:36:28 +01:00
parent e9edb8bab4
commit dd28204797
3 changed files with 48 additions and 0 deletions

View File

@@ -54,6 +54,11 @@ pub const Document = struct {
const root = parser.documentGetDocumentElement(self);
return collection.HTMLCollectionByTagName(parser.elementToNode(root), tag_name);
}
pub fn _getElementsByClassName(self: *parser.Document, classNames: []const u8) !collection.HTMLCollection {
const root = parser.documentGetDocumentElement(self);
return collection.HTMLCollectionByClassName(parser.elementToNode(root), classNames);
}
};
// Tests