page-002.html (1126B)
1 <!DOCTYPE html> 2 <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> 3 <link rel="help" href="https://drafts.csswg.org/cssom/#the-csspagerule-interface"> 4 <title>Add / remove declarations inside CSSPageRule</title> 5 <style id="sheet"> 6 @page {} 7 </style> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script> 11 var sheet = document.getElementById("sheet").sheet; 12 var pageRule = sheet.rules[0]; 13 var style = pageRule.style; 14 test(()=> { 15 assert_equals(style.length, 0); 16 style.setProperty("margin-left", "50%"); 17 assert_equals(style.length, 1); 18 assert_equals(style.marginLeft, "50%"); 19 style.setProperty("margin-left", "100px"); 20 assert_equals(style.length, 1); 21 assert_equals(style.marginLeft, "100px"); 22 style.setProperty("margin", "auto"); 23 assert_equals(style.length, 4); 24 assert_equals(style.marginLeft, "auto"); 25 }, "Add declarations"); 26 27 test(()=> { 28 assert_equals(style.length, 4); 29 style.removeProperty("margin"); 30 assert_equals(style.length, 0); 31 }, "Remove declarations"); 32 </script>