mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
HTMLDocument: implement all getter
This commit is contained in:
@@ -167,6 +167,18 @@ pub fn HTMLCollectionByName(
|
||||
};
|
||||
}
|
||||
|
||||
pub fn HTMLCollectionAll(
|
||||
root: ?*parser.Node,
|
||||
include_root: bool,
|
||||
) !HTMLCollection {
|
||||
return HTMLCollection{
|
||||
.root = root,
|
||||
.walker = Walker{ .walkerDepthFirst = .{} },
|
||||
.matcher = Matcher{ .matchTrue = .{} },
|
||||
.include_root = include_root,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn HTMLCollectionChildren(
|
||||
root: ?*parser.Node,
|
||||
include_root: bool,
|
||||
|
||||
@@ -138,6 +138,10 @@ pub const HTMLDocument = struct {
|
||||
return try collection.HTMLCollectionByAnchors(try rootNode(self), false);
|
||||
}
|
||||
|
||||
pub fn get_all(self: *parser.DocumentHTML) !collection.HTMLCollection {
|
||||
return try collection.HTMLCollectionAll(try rootNode(self), true);
|
||||
}
|
||||
|
||||
pub fn get_currentScript(_: *parser.DocumentHTML) !?*parser.Element {
|
||||
return null;
|
||||
}
|
||||
@@ -219,6 +223,7 @@ pub fn testExecFn(
|
||||
.{ .src = "document.links.length", .ex = "1" },
|
||||
.{ .src = "document.applets.length", .ex = "0" },
|
||||
.{ .src = "document.anchors.length", .ex = "0" },
|
||||
.{ .src = "document.all.length", .ex = "8" },
|
||||
.{ .src = "document.currentScript", .ex = "null" },
|
||||
};
|
||||
try checkCases(js_env, &getters);
|
||||
|
||||
Reference in New Issue
Block a user