From 8daa525cc1428b5560563ae9de7220c87317a842 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 19 May 2025 12:16:07 +0200 Subject: [PATCH] implementation: remove the setTitle method call Libdom uses the doc's body and title attributes by default. But it fallback to the DOM tree if the attributes are NULL. I think it's better to have only the DOM tree set on document creation. --- src/browser/dom/implementation.zig | 5 ++++- src/browser/netsurf.zig | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/browser/dom/implementation.zig b/src/browser/dom/implementation.zig index b9cbb592..55d302a1 100644 --- a/src/browser/dom/implementation.zig +++ b/src/browser/dom/implementation.zig @@ -61,7 +61,10 @@ test "Browser.DOM.Implementation" { try runner.testCases(&.{ .{ "let impl = document.implementation", "undefined" }, .{ "impl.createHTMLDocument();", "[object HTMLDocument]" }, - .{ "impl.createHTMLDocument('foo');", "[object HTMLDocument]" }, + .{ "const doc = impl.createHTMLDocument('foo');", "undefined" }, + .{ "doc", "[object HTMLDocument]" }, + .{ "doc.title", "foo" }, + .{ "doc.body", "[object HTMLBodyElement]" }, .{ "impl.createDocument(null, 'foo');", "[object Document]" }, .{ "impl.createDocumentType('foo', 'bar', 'baz')", "[object DocumentType]" }, .{ "impl.hasFeature()", "true" }, diff --git a/src/browser/netsurf.zig b/src/browser/netsurf.zig index 6e7dbeb6..5a2066ee 100644 --- a/src/browser/netsurf.zig +++ b/src/browser/netsurf.zig @@ -1912,7 +1912,6 @@ pub inline fn domImplementationCreateHTMLDocument(title: ?[]const u8) !*Document _ = try nodeAppendChild(elementToNode(html), elementToNode(head)); if (title) |t| { - try documentHTMLSetTitle(doc_html, t); const htitle = try documentCreateElement(doc, "title"); const txt = try documentCreateTextNode(doc, t); _ = try nodeAppendChild(elementToNode(htitle), @as(*Node, @ptrCast(txt)));