| <!DOCTYPE html> | |
| <meta charset=utf8> | |
| <script src="../../fast/js/resources/js-test-pre.js"></script> | |
| <p id="description"></p> | |
| <div id="console"> | |
| Tests that hidden in markup works: | |
| <div hidden><span class=fail>FAIL</span> - this line should not appear</div><div hidden=hidden><span class=fail>FAIL</span> - this line should not appear</div><div hidden=false><span class=fail>FAIL</span> - this line should not appear</div><p hidden><span class=fail>FAIL</span> - this line should not appear</p><span hidden><span class=fail>FAIL</span> - this line should not appear</span><img width=400px alt="FAIL - this should not appear" src="resources/xxx-missing.jpeg" hidden> | |
| Tests that dynamically adding/removing hidden works: | |
| <div hidden id=test1><span class=pass>PASS</span> - this line should appear<div id=test2><span class=fail>FAIL</span> - this line should not appear</div> | |
| </div> | |
| <script> | |
| description('Various tests for the hidden attribute.'); | |
| document.getElementById("test1").removeAttribute("hidden"); | |
| document.getElementById("test2").setAttribute("hidden", ""); | |
| var testParent = document.createElement('div'); | |
| document.body.appendChild(testParent); | |
| debug('Dynamic changing of hidden and effects on style:'); | |
| testParent.innerHTML="<div id=test3 hidden>a</div><div id=test4>b</div>" | |
| var test3 = document.getElementById("test3"); | |
| var test4 = document.getElementById("test4"); | |
| shouldBe('getComputedStyle(test3, false).display', '"none"'); | |
| test3.removeAttribute("hidden"); | |
| debug('test3.removeAttribute("hidden")'); | |
| shouldBe('getComputedStyle(test3, false).display', '"block"'); | |
| shouldBe('getComputedStyle(test4, false).display', '"block"'); | |
| test4.setAttribute("hidden", ""); | |
| debug('test4.setAttribute("hidden", "")'); | |
| shouldBe('getComputedStyle(test4, false).display', '"none"'); | |
| </script> | |
| <script src="../../fast/js/resources/js-test-post.js"></script> | |
| </body> | |
| </html> |