mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02: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:
committed by
Tim Ledbetter
parent
f7dfe03cf6
commit
42b31820a6
Notes:
github-actions[bot]
2024-11-06 05:47:30 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/42b31820a65 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2187 Reviewed-by: https://github.com/shannonbooth Reviewed-by: https://github.com/tcl3 ✅
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>
|
||||
Reference in New Issue
Block a user