dom: declare document prepend/append/replaceChildren

This commit is contained in:
Pierre Tachoire
2023-12-13 15:52:05 +01:00
parent 84aad08806
commit c0643398d7
2 changed files with 26 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ const parser = @import("../netsurf.zig");
const jsruntime = @import("jsruntime");
const Case = jsruntime.test_utils.Case;
const checkCases = jsruntime.test_utils.checkCases;
const Variadic = jsruntime.Variadic;
const Node = @import("node.zig").Node;
const NodeList = @import("nodelist.zig").NodeList;
@@ -228,6 +229,28 @@ pub const Document = struct {
return list;
}
// TODO according with https://dom.spec.whatwg.org/#parentnode, the
// function must accept either node or string.
// blocked by https://github.com/lightpanda-io/jsruntime-lib/issues/114
pub fn _prepend(_: *parser.Document, _: ?Variadic(*parser.Node)) !void {
return parser.DOMError.HierarchyRequest;
}
// TODO according with https://dom.spec.whatwg.org/#parentnode, the
// function must accept either node or string.
// blocked by https://github.com/lightpanda-io/jsruntime-lib/issues/114
pub fn _append(_: *parser.Document, _: ?Variadic(*parser.Node)) !void {
return parser.DOMError.HierarchyRequest;
}
// TODO according with https://dom.spec.whatwg.org/#parentnode, the
// function must accept either node or string.
// blocked by https://github.com/lightpanda-io/jsruntime-lib/issues/114
pub fn _replaceChildren(_: *parser.Document, _: ?Variadic(*parser.Node)) !void {
// TODO implement function correctly
return parser.DOMError.HierarchyRequest;
}
pub fn deinit(_: *parser.Document, _: std.mem.Allocator) void {}
};