mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-13 12:31:51 +00:00
After f7a3f785a8
, sibling nodes' styles
were no longer invalidated after a node was removed. This reuses the
flag for `:first-child` and `:last-child` to indicate that a node's
style might be affected by any structural change in its siblings.
Fixes #4631.
Resolves the `:only-child` ACID3 failure as documented in #1231.
30 lines
938 B
HTML
30 lines
938 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<style>
|
|
div#a p:only-child {
|
|
background-color: green;
|
|
}
|
|
div#b p:first-of-type {
|
|
background-color: green;
|
|
}
|
|
div#c p:last-of-type {
|
|
background-color: green;
|
|
}
|
|
</style>
|
|
<div id="a"><p>foo</p><p>bar</p></div>
|
|
<div id="b"><p>foo</p><p>bar</p></div>
|
|
<div id="c"><p>foo</p><p>bar</p></div>
|
|
<script>
|
|
test(() => {
|
|
document.body.offsetWidth; // force layout
|
|
|
|
document.querySelector('div#a p:last-child').remove();
|
|
println(`div#a p: ${getComputedStyle(document.querySelector('div#a p')).backgroundColor}`);
|
|
|
|
document.querySelector('div#b p:first-child').remove();
|
|
println(`div#b p: ${getComputedStyle(document.querySelector('div#b p')).backgroundColor}`);
|
|
|
|
document.querySelector('div#c p:last-child').remove();
|
|
println(`div#c p: ${getComputedStyle(document.querySelector('div#c p')).backgroundColor}`);
|
|
});
|
|
</script>
|