mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Use UTF-16 code units length in CharacterData::replace_data()
Range API uses UTF-16 code units to represent offsets, so replace_data() needs to use it instead of bytes count while calculating new offsets. Fixes incorrectly thrown exception when non-latin string is passed into replace_data().
This commit is contained in:
parent
f7dfe03cf6
commit
42b31820a6
Notes:
github-actions[bot]
2024-11-06 05:47:30 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 42b31820a6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2187
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 18 additions and 2 deletions
13
Tests/LibWeb/Text/input/text-insertData.html
Normal file
13
Tests/LibWeb/Text/input/text-insertData.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="include.js"></script>
|
||||
<div id="text">==</div>
|
||||
<script>
|
||||
test(() => {
|
||||
const text = document.getElementById("text");
|
||||
const range = document.createRange();
|
||||
range.setStart(text.firstChild, 0);
|
||||
range.setEnd(text.firstChild, text.firstChild.length);
|
||||
text.firstChild.insertData(1, "Привет");
|
||||
println(range.toString());
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue