forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
5 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-modify-computed.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Calling setProperty() on a computed CSSStyleDeclaration throws error of type: NoModificationAllowedError | ||
Calling removeProperty() on a computed CSSStyleDeclaration throws error of type: NoModificationAllowedError |
19 changes: 19 additions & 0 deletions
19
Tests/LibWeb/Text/input/css/CSSStyleDeclaration-modify-computed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<script src="../include.js"></script> | ||
<script> | ||
test(() => { | ||
try { | ||
document.defaultView.getComputedStyle(document.body, 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.body, null).removeProperty("foo"); | ||
println("FAIL"); | ||
} catch (e) { | ||
println(`Calling removeProperty() on a computed CSSStyleDeclaration throws error of type: ${e.name}`); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters