style_attribute_tests.js (704B)
1 SimpleTest.waitForExplicitFinish(); 2 3 window.addEventListener("load", runTests); 4 5 function runTests(event) { 6 if (event.target != document) { 7 return; 8 } 9 10 var elt = document.getElementById("content"); 11 12 elt.setAttribute("style", "color: blue; background-color: fuchsia"); 13 is(elt.style.color, "blue", "setting correct style attribute (color)"); 14 is( 15 elt.style.backgroundColor, 16 "fuchsia", 17 "setting correct style attribute (color)" 18 ); 19 20 elt.setAttribute("style", "{color: blue; background-color: fuchsia}"); 21 is(elt.style.color, "", "setting braced style attribute (color)"); 22 is(elt.style.backgroundColor, "", "setting braced style attribute (color)"); 23 24 SimpleTest.finish(); 25 }