test_exposed_prop_accessors.html (1558B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=375363 5 --> 6 <head> 7 <title>Test for cloning of CSS property values (including 'inherit', 'initial' and 'unset')</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script type="text/javascript" src="property_database.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 11 </head> 12 <body> 13 <p id="display"></p> 14 <pre id="test"> 15 <script class="testbody" type="text/javascript"> 16 17 /** 18 * Test that makes sure that we have exposed getters/setters for all the 19 * various variants of our CSS property names that the spec calls for. 20 */ 21 for (var prop in gCSSProperties) { 22 var info = gCSSProperties[prop]; 23 24 var s = document.createElement("div").style; 25 26 if (info.domPropDisabled) { 27 // Certain properties like -moz-appearance is intentionally hidden from 28 // CSSStyleProperties. 29 is(s[info.domProp], undefined, `${prop} should not exist`); 30 continue; 31 } 32 33 is(s[info.domProp], "", prop + " should not be set yet"); 34 s[info.domProp] = info.initial_values[0]; 35 isnot(s[info.domProp], "", prop + " should now be set"); 36 is(s[prop], s[info.domProp], 37 "Getting " + prop + " via name should work") 38 s = document.createElement("div").style; 39 is(s[info.domProp], "", prop + " should not be set here either"); 40 s[prop] = info.initial_values[0]; 41 isnot(s[info.prop], "", prop + " should now be set again"); 42 is(s[info.domProp], s[prop], 43 "Setting " + prop + " via name should work"); 44 } 45 </script> 46 </pre> 47 </body> 48 </html>