mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
characterdata: add length getter
Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
@@ -19,6 +19,12 @@ pub const CharacterData = struct {
|
|||||||
// JS funcs
|
// JS funcs
|
||||||
// --------
|
// --------
|
||||||
|
|
||||||
|
// Read attributes
|
||||||
|
|
||||||
|
pub fn get_length(self: *parser.CharacterData) u32 {
|
||||||
|
return parser.characterDataLength(self);
|
||||||
|
}
|
||||||
|
|
||||||
// Read/Write attributes
|
// Read/Write attributes
|
||||||
|
|
||||||
pub fn get_data(self: *parser.CharacterData) []const u8 {
|
pub fn get_data(self: *parser.CharacterData) []const u8 {
|
||||||
@@ -58,4 +64,9 @@ pub fn testExecFn(
|
|||||||
.{ .src = "cdata_t.data = 'OK'", .ex = "OK" },
|
.{ .src = "cdata_t.data = 'OK'", .ex = "OK" },
|
||||||
};
|
};
|
||||||
try checkCases(js_env, &set_data);
|
try checkCases(js_env, &set_data);
|
||||||
|
|
||||||
|
var get_length = [_]Case{
|
||||||
|
.{ .src = "cdata_t.length === 2", .ex = "true" },
|
||||||
|
};
|
||||||
|
try checkCases(js_env, &get_length);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -435,6 +435,12 @@ pub fn characterDataSetData(cdata: *CharacterData, data: []const u8) void {
|
|||||||
_ = characterDataVtable(cdata).dom_characterdata_set_data.?(cdata, s);
|
_ = characterDataVtable(cdata).dom_characterdata_set_data.?(cdata, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn characterDataLength(cdata: *CharacterData) u32 {
|
||||||
|
var n: u32 = undefined;
|
||||||
|
_ = characterDataVtable(cdata).dom_characterdata_get_length.?(cdata, &n);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
pub const Text = c.dom_text;
|
pub const Text = c.dom_text;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user