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.
This commit is contained in:
Pierre Tachoire
2025-05-19 12:16:07 +02:00
parent a99d193b12
commit 8daa525cc1
2 changed files with 4 additions and 2 deletions

View File

@@ -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" },

View File

@@ -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)));