dom: document: re-dispatch document function according to spec

This commit is contained in:
Pierre Tachoire
2023-10-17 18:18:38 +02:00
parent 8f6016e0fd
commit 9dda08b8a9
5 changed files with 70 additions and 33 deletions

View File

@@ -3,16 +3,17 @@ const std = @import("std");
const parser = @import("../netsurf.zig");
const Node = @import("node.zig").Node;
const Union = @import("node.zig").Union;
const HTMLElem = @import("../html/elements.zig");
pub const Union = @import("../html/elements.zig").Union;
// WEB IDL https://dom.spec.whatwg.org/#element
pub const Element = struct {
pub const Self = parser.Element;
pub const prototype = *Node;
pub const mem_guarantied = true;
pub fn toInterface(e: *parser.Element) Union {
const n = @as(*parser.Node, @ptrCast(e));
return Node.toInterface(n);
return HTMLElem.toInterface(Union, e);
}
// JS funcs