webkit-appearance-serialization.html (1462B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Serialization of `-webkit-appearance`</title> 6 <link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 </head> 10 <body> 11 <script> 12 test(function() { 13 var input = document.createElement('input'); 14 input.style.setProperty('-webkit-appearance', 'none'); 15 16 assert_equals(input.style.cssText, 'appearance: none;'); 17 }, 'serialization via CSSStyleDeclaration'); 18 19 test(function(t) { 20 var style = document.createElement('style'); 21 document.body.appendChild(style); 22 t.add_cleanup(function() { 23 document.body.removeChild(style); 24 }); 25 style.sheet.insertRule('#foo {}', 0); 26 style.sheet.cssRules[0].style.setProperty('-webkit-appearance', 'none'); 27 28 assert_equals( 29 style.sheet.cssRules[0].cssText, '#foo { appearance: none; }' 30 ); 31 }, 'serialization via CSSStyleRule'); 32 33 test(function(t) { 34 var style = document.createElement('style'); 35 document.body.appendChild(style); 36 t.add_cleanup(function() { 37 document.body.removeChild(style); 38 }); 39 style.sheet.insertRule('@media print { #foo {} }', 0); 40 style.sheet.cssRules[0].cssRules[0].style.setProperty('-webkit-appearance', 'none'); 41 42 assert_equals( 43 style.sheet.cssRules[0].cssText, 44 '@media print {\n #foo { appearance: none; }\n}' 45 ); 46 }, 'serialization via CSSMediaRule'); 47 </script> 48 </body>