| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/hidden-attr-dom.js"></script> | 7 <script> |
| 8 description('Various tests for the the hidden IDL attribute.'); |
| 9 |
| 10 var testParent = document.createElement('div'); |
| 11 document.body.appendChild(testParent); |
| 12 |
| 13 debug('The IDL attribute reflects what is present in markup:'); |
| 14 testParent.innerHTML = '<div id=h1 hidden></div><div id=h2 hidden=false></div><d
iv id=h3 hidden=off></div><div id=s1></div>'; |
| 15 var h1 = document.getElementById("h1"); |
| 16 var h2 = document.getElementById("h2"); |
| 17 var h3 = document.getElementById("h3"); |
| 18 var s1 = document.getElementById("s1"); |
| 19 |
| 20 shouldBeTrue('h1.hidden'); |
| 21 shouldBeTrue('h2.hidden'); |
| 22 shouldBeTrue('h3.hidden'); |
| 23 shouldBeFalse('s1.hidden'); |
| 24 |
| 25 debug('Changes via DOM Core are reflected through the IDL attribute:'); |
| 26 |
| 27 shouldBeFalse('(h1.removeAttribute("hidden"), h1.hidden)'); |
| 28 shouldBeTrue('(h1.setAttribute("hidden", ""), h1.hidden)'); |
| 29 shouldBeTrue('(h2.setAttribute("hidden", ""), h2.hidden)'); |
| 30 shouldBeTrue('(s1.setAttribute("hidden", ""), s1.hidden)'); |
| 31 |
| 32 debug('Changes via IDL attribute are reflected in the core DOM:'); |
| 33 |
| 34 shouldBe('(h3.hidden = false, h3.getAttribute("hidden"))', 'null'); |
| 35 shouldBe('(h3.hidden = true, h3.getAttribute("hidden"))', '""'); |
| 36 </script> |
| 8 </body> | 37 </body> |
| 9 </html> | 38 </html> |
| OLD | NEW |