mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Add CSSStyleSheet constructor binding
This commit is contained in:
committed by
Andreas Kling
parent
f303905875
commit
b0f57a2785
Notes:
sideshowbarker
2024-07-17 06:45:52 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/b0f57a2785 Pull-request: https://github.com/SerenityOS/serenity/pull/23327 Reviewed-by: https://github.com/awesomekling
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>
|
||||
Reference in New Issue
Block a user