dom: add document.createCDATASection

This commit is contained in:
Pierre Tachoire
2023-12-07 16:27:26 +01:00
parent 894b6182cf
commit 94876d01f1
5 changed files with 34 additions and 0 deletions

View File

@@ -133,6 +133,10 @@ pub const Document = struct {
return try parser.documentCreateTextNode(self, data);
}
pub fn _createCDATASection(self: *parser.Document, data: []const u8) !*parser.CDATASection {
return try parser.documentCreateCDATASection(self, data);
}
pub fn deinit(_: *parser.Document, _: std.mem.Allocator) void {}
};
@@ -235,6 +239,11 @@ pub fn testExecFn(
};
try checkCases(js_env, &createTextNode);
var createCDATASection = [_]Case{
.{ .src = "document.createCDATASection('foo')", .ex = "[object CDATASection]" },
};
try checkCases(js_env, &createCDATASection);
const tags = comptime parser.Tag.all();
comptime var createElements: [(tags.len) * 2]Case = undefined;
inline for (tags, 0..) |tag, i| {