1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

LibWeb: Fix infinite loop in ChildNode's before() and after()

The loop that was supposed to check the chain of previous or next
siblings had a logic mistake where it would never traverse the chain,
so we would get stuck looking at the immediate sibling forever.
This commit is contained in:
Andreas Kling 2024-03-11 15:27:23 +01:00
parent ad843b6e4a
commit 35f359c51c
5 changed files with 47 additions and 11 deletions

View file

@ -0,0 +1,13 @@
<script src="../include.js"></script>
<div id="one"></div><div id="two"></div><script>
test(() => {
let one = document.getElementById("one");
let two = document.getElementById("two");
one.after(two);
printElement(one);
printElement(one.nextSibling);
printElement(two);
printElement(two.previousSibling);
println("PASS (didn't crash)");
});
</script>