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

@@ -154,8 +154,8 @@ fn runWPT(arena: *std.heap.ArenaAllocator, f: []const u8, loader: *FileLoader) !
const alloc = arena.allocator();
// document
const htmldoc = try parser.documentHTMLParseFromFileAlloc(alloc, f);
var doc = parser.documentHTMLToDocument(htmldoc);
const html_doc = try parser.documentHTMLParseFromFileAlloc(alloc, f);
const doc = parser.documentHTMLToDocument(html_doc);
// create JS env
var loop = try Loop.init(alloc);
@@ -172,7 +172,7 @@ fn runWPT(arena: *std.heap.ArenaAllocator, f: []const u8, loader: *FileLoader) !
defer js_env.stop();
// add document object
try js_env.addObject(apis, doc, "document");
try js_env.addObject(apis, html_doc, "document");
// alias global as self and window
try js_env.attachObject(try js_env.getGlobal(), "self", null);