Skip to content

Commit

Permalink
dom: fix adoptNode and importNode return
Browse files Browse the repository at this point in the history
  • Loading branch information
krichprollsch committed Dec 7, 2023
1 parent 807b327 commit 24494ce
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dom/document.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Case = jsruntime.test_utils.Case;
const checkCases = jsruntime.test_utils.checkCases;

const Node = @import("node.zig").Node;
const NodeUnion = @import("node.zig").Union;

const collection = @import("html_collection.zig");

Expand Down Expand Up @@ -145,12 +146,14 @@ pub const Document = struct {
return try parser.documentCreateProcessingInstruction(self, target, data);
}

pub fn _importNode(self: *parser.Document, node: *parser.Node, deep: ?bool) !*parser.Node {
return try parser.documentImportNode(self, node, deep orelse false);
pub fn _importNode(self: *parser.Document, node: *parser.Node, deep: ?bool) !NodeUnion {
const n = try parser.documentImportNode(self, node, deep orelse false);
return try Node.toInterface(n);
}

pub fn _adoptNode(self: *parser.Document, node: *parser.Node) !*parser.Node {
return try parser.documentAdoptNode(self, node);
pub fn _adoptNode(self: *parser.Document, node: *parser.Node) !NodeUnion {
const n = try parser.documentAdoptNode(self, node);
return try Node.toInterface(n);
}

pub fn _createAttribute(self: *parser.Document, name: []const u8) !*parser.Attribute {
Expand Down

0 comments on commit 24494ce

Please sign in to comment.