test_hidden.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=567663
  5. -->
  6. <head>
  7. <title>Test for Bug 567663</title>
  8. <script src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
  10. </head>
  11. <body>
  12. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=567663">Mozilla Bug 567663</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. <p></p>
  16. <p hidden></p>
  17. </div>
  18. <pre id="test">
  19. <script>
  20. /** Test for Bug 567663 **/
  21. var ps = document.getElementById("content").getElementsByTagName("p");
  22. is(ps[0].hidden, false, "First p's IDL attribute was wrong.");
  23. is(ps[0].hasAttribute("hidden"), false, "First p had a content attribute.");
  24. is(ps[1].hidden, true, "Second p's IDL attribute was wrong.");
  25. is(ps[1].hasAttribute("hidden"), true,
  26. "Second p didn't have a content attribute.");
  27. is(ps[1].getAttribute("hidden"), "",
  28. "Second p's content attribute was wrong.");
  29. ps[0].hidden = true;
  30. is(ps[0].getAttribute("hidden"), "",
  31. "Content attribute was set to an incorrect value.");
  32. ps[1].hidden = false;
  33. is(ps[1].hasAttribute("hidden"), false,
  34. "Second p still had a content attribute.");
  35. ps[0].setAttribute("hidden", "banana");
  36. is(ps[0].hidden, true, "p's IDL attribute was wrong after setting.");
  37. is(ps[0].getAttribute("hidden"), "banana", "Content attribute changed.");
  38. ps[0].setAttribute("hidden", "false");
  39. is(ps[0].hidden, true, "p's IDL attribute was wrong after setting.");
  40. is(ps[0].getAttribute("hidden"), "false", "Content attribute changed.");
  41. ps[0].removeAttribute("hidden");
  42. is(ps[0].hidden, false,
  43. "p's IDL attribute was wrong after removing the content attribute.");
  44. is(ps[0].hasAttribute("hidden"), false);
  45. </script>
  46. </pre>
  47. </body>
  48. </html>