Files
serenity/Tests/LibWeb/Text/input/css/CSSStyleDeclaration-modify-computed.html
Tim Ledbetter adebc2a214 LibWeb: Return error on modification of a computed CSS style declaration
Previously, calling `setProperty` or `removeProperty` from JS on a
CSSStyleDeclaration returned from `getComputedStyle()` would return
null. We now return a NoModificationAllowedError instead, which aligns
our implementation with the specification.

(cherry picked from commit ea68bdef26260762dec02413cce0d79caef6f4a4)
2024-11-08 21:51:25 -05:00

20 lines
690 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
try {
document.defaultView.getComputedStyle(document.documentElement, null).setProperty("foo", "bar");
println("FAIL");
} catch (e) {
println(`Calling setProperty() on a computed CSSStyleDeclaration throws error of type: ${e.name}`);
}
try {
document.defaultView.getComputedStyle(document.documentElement, null).removeProperty("foo");
println("FAIL");
} catch (e) {
println(`Calling removeProperty() on a computed CSSStyleDeclaration throws error of type: ${e.name}`);
}
});
</script>