ladybird/Tests/LibWeb/Text/input/css/CSSStyleDeclaration-custom-properties.html
2024-11-21 13:16:08 +01:00

24 lines
No EOL
859 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<body></body>
<script>
test(() => {
const div = document.createElement('div');
div.style.setProperty("--redcolor", "red");
println(`style.getPropertyValue(--redcolor)=${div.style.getPropertyValue("--redcolor")}`);
println(`style.getPropertyPriority(--redcolor)=${div.style.getPropertyPriority("--redcolor")}`);
const nested = document.createElement('div');
nested.style["backgroundColor"] = "var(--redcolor)";
nested.style["width"] = "100px";
nested.style["height"] = "100px";
div.appendChild(nested);
document.body.appendChild(div);
println(getComputedStyle(nested).backgroundColor);
div.style.removeProperty("--redcolor");
println(getComputedStyle(nested).backgroundColor);
});
</script>