From 7bd4729d3f5b972d18582d384ba1fe53019b3467 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 27 Nov 2023 11:46:57 +0100 Subject: [PATCH] dom: add document.implementation --- src/dom/document.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dom/document.zig b/src/dom/document.zig index f364b1bc..ef3f4831 100644 --- a/src/dom/document.zig +++ b/src/dom/document.zig @@ -14,6 +14,7 @@ const Element = @import("element.zig").Element; const ElementUnion = @import("element.zig").Union; const DocumentType = @import("document_type.zig").DocumentType; +const DOMImplementation = @import("implementation.zig").DOMImplementation; // WEB IDL https://dom.spec.whatwg.org/#document pub const Document = struct { @@ -28,7 +29,11 @@ pub const Document = struct { // JS funcs // -------- - // + + pub fn get_implementation(_: *parser.Document) DOMImplementation { + return DOMImplementation{}; + } + pub fn get_documentElement(self: *parser.Document) ElementUnion { const e = parser.documentGetDocumentElement(self); return Element.toInterface(e); @@ -198,6 +203,11 @@ pub fn testExecFn( }; try checkCases(js_env, &getDocumentURI); + var getImplementation = [_]Case{ + .{ .src = "let impl = document.implementation", .ex = "undefined" }, + }; + try checkCases(js_env, &getImplementation); + const tags = comptime parser.Tag.all(); comptime var createElements: [(tags.len) * 2]Case = undefined; inline for (tags, 0..) |tag, i| {