Skip to content

Commit

Permalink
Merge pull request #78 from Browsercore/domcdoc-encoding
Browse files Browse the repository at this point in the history
dom: implement document.characterSet
  • Loading branch information
krichprollsch authored Nov 27, 2023
2 parents 3ebc9a1 + ec06190 commit 559ecd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/dom/document.zig
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ pub const Document = struct {
return "CSS1Compat";
}

// TODO implement characterSet
pub fn get_characterSet(self: *parser.Document) []const u8 {
_ = self;
return "UTF-8";
return parser.documentGetInputEncoding(self);
}

// alias of get_characterSet
Expand Down
6 changes: 6 additions & 0 deletions src/netsurf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,12 @@ pub inline fn documentGetDocumentURI(doc: *Document) []const u8 {
return stringToData(s.?);
}

pub inline fn documentGetInputEncoding(doc: *Document) []const u8 {
var s: ?*String = undefined;
_ = documentVtable(doc).dom_document_get_input_encoding.?(doc, &s);
return stringToData(s.?);
}

pub inline fn documentCreateElement(doc: *Document, tag_name: []const u8) *Element {
var elem: ?*Element = undefined;
_ = documentVtable(doc).dom_document_create_element.?(doc, stringFromData(tag_name), &elem);
Expand Down

0 comments on commit 559ecd1

Please sign in to comment.