mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
dom: add document.characterSet with hardcoded value
This commit is contained in:
@@ -34,6 +34,22 @@ pub const Document = struct {
|
|||||||
return Element.toInterface(e);
|
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 {
|
pub fn get_doctype(self: *parser.Document) ?*parser.DocumentType {
|
||||||
return parser.documentGetDoctype(self);
|
return parser.documentGetDoctype(self);
|
||||||
}
|
}
|
||||||
@@ -123,6 +139,13 @@ pub fn testExecFn(
|
|||||||
};
|
};
|
||||||
try checkCases(js_env, &getDocumentElement);
|
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();
|
const tags = comptime parser.Tag.all();
|
||||||
comptime var createElements: [(tags.len) * 2]Case = undefined;
|
comptime var createElements: [(tags.len) * 2]Case = undefined;
|
||||||
inline for (tags, 0..) |tag, i| {
|
inline for (tags, 0..) |tag, i| {
|
||||||
|
|||||||
Reference in New Issue
Block a user