mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-04-23 13:04:43 +00:00
Previously, we would apply any adopted style sheet to the document if its alternate flag was not set. This meant that all adopted style sheets would be applied, since constructed style sheets never have this flag set.
21 lines
869 B
HTML
21 lines
869 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
function constructedStyleSheetAppliesToDocument(options) {
|
|
const textDiv = document.createElement("div");
|
|
document.body.appendChild(textDiv);
|
|
const sheet = new CSSStyleSheet(options);
|
|
const newColor = "rgb(0, 128, 0)";
|
|
sheet.replaceSync(`div { color: ${newColor}; }`);
|
|
document.adoptedStyleSheets = [sheet];
|
|
const styleSheetAppliedToDocument = getComputedStyle(textDiv).color === newColor;
|
|
document.body.removeChild(textDiv);
|
|
document.adoptedStyleSheets = [];
|
|
return styleSheetAppliedToDocument;
|
|
}
|
|
|
|
println(`Disabled constructed style sheet applies to document: ${constructedStyleSheetAppliesToDocument({ disabled: true })}`);
|
|
});
|
|
</script>
|