style_attribute_tests.js 748 B

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