1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibWeb: Forward media attribute from link element to loaded style sheet

Otherwise, we will treat the loaded style sheet as if it had media="all"
which is not always appropriate.
This commit is contained in:
Andreas Kling 2023-06-10 19:53:36 +02:00
parent a6c6c24428
commit 8a43f5a64a
4 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<style>
body {
background: green;
}
</style>
<script src="include.js"></script>
<script>
let link = document.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("href", "body-background-color-red.css");
link.setAttribute("media", "print")
document.head.appendChild(link)
window.onload = function() {
println("document background: " + getComputedStyle(document.body).backgroundColor)
}
</script>