Bug 1880216 - Migrate Fenix docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / dom / html / test / test_hidden.html
blob7b9d488c0ee68db69134dfa1716053ac1ae7667f
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.");
30 ps[0].hidden = true;
31 is(ps[0].getAttribute("hidden"), "",
32 "Content attribute was set to an incorrect value.");
33 ps[1].hidden = false;
34 is(ps[1].hasAttribute("hidden"), false,
35 "Second p still had a content attribute.");
37 ps[0].setAttribute("hidden", "banana");
38 is(ps[0].hidden, true, "p's IDL attribute was wrong after setting.");
39 is(ps[0].getAttribute("hidden"), "banana", "Content attribute changed.");
41 ps[0].setAttribute("hidden", "false");
42 is(ps[0].hidden, true, "p's IDL attribute was wrong after setting.");
43 is(ps[0].getAttribute("hidden"), "false", "Content attribute changed.");
45 ps[0].removeAttribute("hidden");
46 is(ps[0].hidden, false,
47 "p's IDL attribute was wrong after removing the content attribute.");
48 is(ps[0].hasAttribute("hidden"), false);
49 </script>
50 </pre>
51 </body>
52 </html>