dom: implement document.createProcessingInstruction

This commit is contained in:
Pierre Tachoire
2023-12-07 16:48:02 +01:00
parent 24ec5f554d
commit d13da6ffab
5 changed files with 41 additions and 0 deletions

View File

@@ -141,6 +141,10 @@ pub const Document = struct {
return try parser.documentCreateComment(self, data);
}
pub fn _createProcessingInstruction(self: *parser.Document, target: []const u8, data: []const u8) !*parser.ProcessingInstruction {
return try parser.documentCreateProcessingInstruction(self, target, data);
}
pub fn deinit(_: *parser.Document, _: std.mem.Allocator) void {}
};
@@ -253,6 +257,11 @@ pub fn testExecFn(
};
try checkCases(js_env, &createComment);
var createProcessingInstruction = [_]Case{
.{ .src = "document.createProcessingInstruction('foo', 'bar')", .ex = "[object ProcessingInstruction]" },
};
try checkCases(js_env, &createProcessingInstruction);
const tags = comptime parser.Tag.all();
comptime var createElements: [(tags.len) * 2]Case = undefined;
inline for (tags, 0..) |tag, i| {