Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/browser/dom/implementation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
1 change: 0 additions & 1 deletion src/browser/netsurf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

@sjorsdonkers sjorsdonkers May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it would be more performant if we do set it as it would not have to search for it here.
If we keep it, it would be good to comment why it is there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentCreateDocument calls already documentHTMLSetTitle. But moving this tree creation to documentCreateDocument will be clearer.

const htitle = try documentCreateElement(doc, "title");
const txt = try documentCreateTextNode(doc, t);
_ = try nodeAppendChild(elementToNode(htitle), @as(*Node, @ptrCast(txt)));
Expand Down