mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-14 23:22:52 +00:00
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().
13 lines
416 B
HTML
13 lines
416 B
HTML
<!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>
|