mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
node: implement getRootNode
This commit is contained in:
@@ -251,10 +251,13 @@ pub const Node = struct {
|
|||||||
return try parser.nodeContains(self, other);
|
return try parser.nodeContains(self, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn _getRootNode(self: *parser.Node) void {
|
pub fn _getRootNode(self: *parser.Node) !?HTMLElem.Union {
|
||||||
// TODO
|
// TODO return this’s shadow-including root if options["composed"] is true
|
||||||
_ = self;
|
const res = try parser.nodeOwnerDocument(self);
|
||||||
std.log.err("Not implemented {s}", .{"node.getRootNode()"});
|
if (res == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return try HTMLElem.toInterface(HTMLElem.Union, @as(*parser.Element, @ptrCast(res.?)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn _hasChildNodes(self: *parser.Node) !bool {
|
pub fn _hasChildNodes(self: *parser.Node) !bool {
|
||||||
@@ -439,6 +442,11 @@ pub fn testExecFn(
|
|||||||
};
|
};
|
||||||
try checkCases(js_env, &node_compare_document_position);
|
try checkCases(js_env, &node_compare_document_position);
|
||||||
|
|
||||||
|
var get_root_node = [_]Case{
|
||||||
|
.{ .src = "document.getElementById('content').getRootNode().__proto__.constructor.name", .ex = "HTMLDocument" },
|
||||||
|
};
|
||||||
|
try checkCases(js_env, &get_root_node);
|
||||||
|
|
||||||
var first_child = [_]Case{
|
var first_child = [_]Case{
|
||||||
// for next test cases
|
// for next test cases
|
||||||
.{ .src = "let content = document.getElementById('content')", .ex = "undefined" },
|
.{ .src = "let content = document.getElementById('content')", .ex = "undefined" },
|
||||||
|
|||||||
Reference in New Issue
Block a user