2024-11-20 15:48:04 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<script src="../include.js"></script>
|
|
|
|
|
<body></body>
|
|
|
|
|
<script>
|
|
|
|
|
test(() => {
|
|
|
|
|
const div = document.createElement('div');
|
|
|
|
|
div.style.setProperty("--redcolor", "red");
|
2024-11-20 17:21:22 +01:00
|
|
|
println(`style.getPropertyValue(--redcolor)=${div.style.getPropertyValue("--redcolor")}`);
|
2024-11-20 18:11:47 +01:00
|
|
|
println(`style.getPropertyPriority(--redcolor)=${div.style.getPropertyPriority("--redcolor")}`);
|
2024-11-20 15:48:04 +01:00
|
|
|
|
|
|
|
|
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);
|
2024-11-20 17:48:35 +01:00
|
|
|
|
|
|
|
|
div.style.removeProperty("--redcolor");
|
|
|
|
|
println(getComputedStyle(nested).backgroundColor);
|
2024-11-20 15:48:04 +01:00
|
|
|
});
|
|
|
|
|
</script>
|