mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
dom: add document.documentElement getter
This commit is contained in:
@@ -29,6 +29,11 @@ pub const Document = struct {
|
|||||||
// JS funcs
|
// JS funcs
|
||||||
// --------
|
// --------
|
||||||
//
|
//
|
||||||
|
pub fn get_documentElement(self: *parser.Document) ElementUnion {
|
||||||
|
const e = parser.documentGetDocumentElement(self);
|
||||||
|
return Element.toInterface(e);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_doctype(self: *parser.Document) ?*parser.DocumentType {
|
pub fn get_doctype(self: *parser.Document) ?*parser.DocumentType {
|
||||||
return parser.documentGetDoctype(self);
|
return parser.documentGetDoctype(self);
|
||||||
}
|
}
|
||||||
@@ -112,6 +117,12 @@ pub fn testExecFn(
|
|||||||
};
|
};
|
||||||
try checkCases(js_env, &getElementsByClassName);
|
try checkCases(js_env, &getElementsByClassName);
|
||||||
|
|
||||||
|
var getDocumentElement = [_]Case{
|
||||||
|
.{ .src = "let e = document.documentElement", .ex = "undefined" },
|
||||||
|
.{ .src = "e.localName", .ex = "html" },
|
||||||
|
};
|
||||||
|
try checkCases(js_env, &getDocumentElement);
|
||||||
|
|
||||||
const tags = comptime parser.Tag.all();
|
const tags = comptime parser.Tag.all();
|
||||||
comptime var createElements: [(tags.len) * 2]Case = undefined;
|
comptime var createElements: [(tags.len) * 2]Case = undefined;
|
||||||
inline for (tags, 0..) |tag, i| {
|
inline for (tags, 0..) |tag, i| {
|
||||||
|
|||||||
Reference in New Issue
Block a user