ladybird/Tests/LibWeb/Text/input/setting-display-none-should-nuke-subtree.html
Andreas Kling 28fdc7af05 LibWeb: Detach stale layout nodes from DOM during layout tree build
When toggling `display: none` on an element, it can go from having a
layout subtree to not having one. In the `none` case, we were previously
leaving stale layout nodes hanging off DOM nodes in the subtree.

These layout nodes could be queried for outdated information and
probably other things that we shouldn't allow.

Fix this by having TreeBuilder prune any old layout nodes hanging off
nodes in a subtree after its subtree root doesn't produce a layout node.
2023-08-01 09:19:41 +02:00

15 lines
372 B
HTML

<script src="include.js"></script>
<script>
test(() => {
let a = document.createElement("div");
let b = document.createElement("div");
a.appendChild(b);
document.body.appendChild(a);
b.style = 'width: 100px;';
println(b.offsetWidth);
a.style.display = 'none';
println(b.offsetWidth);
});
</script>