mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-14 15:13:07 +00:00
Previously, the parent CSS stylesheet, owner node and owner CSS rule properties were not unset when removing a sheet from a StyleSheetList. This change moves the methods for adding and removing sheets to and from a StyleSheetList, directly into the StyleSheetList class and ensures they are called as required by the CSSOM specification.
31 lines
1.4 KiB
HTML
31 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<script src="include.js"></script>
|
|
<link rel="stylesheet" disabled href="data:text/css,html { background: rgb(0, 128, 0) }">
|
|
<script>
|
|
asyncTest(done => {
|
|
const documentStyle = getComputedStyle(document.documentElement);
|
|
const link = document.querySelector("link");
|
|
println(`link.disabled initial value: ${link.disabled}`);
|
|
println(`document.styleSheets.length initial value: ${document.styleSheets.length}`);
|
|
println(`background color when link is disabled: ${documentStyle.backgroundColor}`);
|
|
|
|
link.onload = () => {
|
|
println("onload event fired");
|
|
println(`link.disabled: ${link.disabled}`);
|
|
println(`document.styleSheets.length: ${document.styleSheets.length}`);
|
|
println(`background color: ${documentStyle.backgroundColor}`);
|
|
const sheet = document.styleSheets[0];
|
|
println(`sheet.ownerNode is link element: ${sheet.ownerNode === link}`);
|
|
|
|
link.disabled = true;
|
|
println(`document.styleSheets.length after link disabled again: ${document.styleSheets.length}`);
|
|
println(`link.disabled after link disabled again: ${link.disabled}`);
|
|
println(`background color after link disabled again: ${documentStyle.backgroundColor}`);
|
|
println(`sheet.ownerNode is null: ${sheet.ownerNode === null}`);
|
|
|
|
done();
|
|
};
|
|
|
|
link.disabled = false;
|
|
});
|
|
</script>
|