mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
LibWeb: Add CSSStyleSheet constructor binding
This commit is contained in:
parent
f303905875
commit
b0f57a2785
8 changed files with 129 additions and 2 deletions
25
Tests/LibWeb/Text/input/css/CSSStyleSheet-constructor.html
Normal file
25
Tests/LibWeb/Text/input/css/CSSStyleSheet-constructor.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const cssRule = "* { font-size: 16px; }";
|
||||
const sheet = new CSSStyleSheet();
|
||||
println(`Empty sheet ownerNode: ${sheet.ownerNode}`);
|
||||
println(`Empty sheet ownerRule: ${sheet.ownerRule}`);
|
||||
println(`Empty sheet title is empty string: ${sheet.title === ""}`);
|
||||
println(`Empty sheet cssRules is empty: ${sheet.cssRules.length === 0}`);
|
||||
println(`Empty sheet is disabled by default: ${sheet.disabled}`);
|
||||
|
||||
sheet.insertRule(cssRule);
|
||||
println(`cssRules length after insertRule(): ${sheet.cssRules.length}`);
|
||||
println(`cssRules text: ${sheet.cssRules[0].cssText}`);
|
||||
|
||||
println(`rules and cssRules are the same object: ${sheet.cssRules === sheet.rules}`);
|
||||
|
||||
sheet.deleteRule(0);
|
||||
println(`cssRules length after deleteRule(): ${sheet.cssRules.length}`);
|
||||
|
||||
const disabledSheet = new CSSStyleSheet({ disabled: true });
|
||||
println(`Disabled sheet is disabled: ${disabledSheet.disabled}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue