declarations-trim-whitespace.html (1975B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Declarations trim whitespace from their beginning/ending</title> 4 <meta name="author" title="Tab Atkins-Bittner"> 5 <link rel=help href="https://drafts.csswg.org/css-syntax/#consume-declaration"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <body> 9 <div id="log"></div> 10 <style id="style-el"> 11 #foo { 12 --foo-1:bar; 13 --foo-2: bar; 14 --foo-3:bar ; 15 --foo-4: bar ; 16 --foo-5: bar !important; 17 --foo-6: bar !important ; 18 --foo-7:bar!important; 19 --foo-8:bar!important ; 20 --foo-9:bar 21 } 22 </style> 23 <p id=foo>foo</p> 24 <script> 25 let stylesheet = getComputedStyle(document.querySelector("#foo")); 26 let canonical = "bar"; 27 test(function() { 28 assert_equals(stylesheet.getPropertyValue("--foo-1"), canonical); 29 }, "--foo-1:bar;"); 30 test(function() { 31 assert_equals(stylesheet.getPropertyValue("--foo-2"), canonical); 32 }, "--foo-2: bar;"); 33 test(function() { 34 assert_equals(stylesheet.getPropertyValue("--foo-3"), canonical); 35 }, "--foo-3:bar ;"); 36 test(function() { 37 assert_equals(stylesheet.getPropertyValue("--foo-4"), canonical); 38 }, "--foo-4: bar ;"); 39 test(function() { 40 assert_equals(stylesheet.getPropertyValue("--foo-5"), canonical); 41 }, "--foo-5: bar !important;"); 42 test(function() { 43 assert_equals(stylesheet.getPropertyValue("--foo-6"), canonical); 44 }, "--foo-6: bar !important ;"); 45 test(function() { 46 assert_equals(stylesheet.getPropertyValue("--foo-7"), canonical); 47 }, "--foo-7:bar!important;"); 48 test(function() { 49 assert_equals(stylesheet.getPropertyValue("--foo-8"), canonical); 50 }, "--foo-8:bar!important ;"); 51 test(function() { 52 assert_equals(stylesheet.getPropertyValue("--foo-9"), canonical); 53 }, "--foo-9:bar (then ws until end of rule)"); 54 </script>