diff --git a/src/dom/document.zig b/src/dom/document.zig index 55b7e1e77..238de0449 100644 --- a/src/dom/document.zig +++ b/src/dom/document.zig @@ -34,6 +34,22 @@ pub const Document = struct { return Element.toInterface(e); } + // TODO implement characterSet + pub fn get_characterSet(self: *parser.Document) []const u8 { + _ = self; + return "UTF-8"; + } + + // alias of get_characterSet + pub fn get_charset(self: *parser.Document) []const u8 { + return get_characterSet(self); + } + + // alias of get_characterSet + pub fn get_inputEncoding(self: *parser.Document) []const u8 { + return get_characterSet(self); + } + pub fn get_doctype(self: *parser.Document) ?*parser.DocumentType { return parser.documentGetDoctype(self); } @@ -123,6 +139,13 @@ pub fn testExecFn( }; try checkCases(js_env, &getDocumentElement); + var getCharacterSet = [_]Case{ + .{ .src = "document.characterSet", .ex = "UTF-8" }, + .{ .src = "document.charset", .ex = "UTF-8" }, + .{ .src = "document.inputEncoding", .ex = "UTF-8" }, + }; + try checkCases(js_env, &getCharacterSet); + const tags = comptime parser.Tag.all(); comptime var createElements: [(tags.len) * 2]Case = undefined; inline for (tags, 0..) |tag, i| {