mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibWeb: Allow splitting surrogate pairs in CharacterData.substringData()
This commit is contained in:
parent
0b775da7c7
commit
b999f925dc
Notes:
github-actions[bot]
2024-10-20 10:19:54 +00:00
Author: https://github.com/shannonbooth
Commit: b999f925dc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1875
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 25 additions and 2 deletions
|
@ -0,0 +1,18 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const str = '\uD83D\uDC36'; // 🐶
|
||||
let t = document.createTextNode(str);
|
||||
println("Before substringData:");
|
||||
for (let i = 0; i < t.length; ++i) {
|
||||
println("[" + i + "]: " + t.data.charCodeAt(i));
|
||||
}
|
||||
|
||||
// Break the surrogate pair
|
||||
const invalidSubstring = t.substringData(0, 1);
|
||||
println("After substringData(0, 1):");
|
||||
for (let i = 0; i < invalidSubstring.length; ++i) {
|
||||
println("[" + i + "]: " + invalidSubstring.charCodeAt(i));
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue