| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 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 id="a"> | 6 <body id="a"> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 description("Test that different ways of changing an element's id all work prope
rly."); | 9 description("Test that different ways of changing an element's id all work prope
rly."); |
| 10 | 10 |
| 11 debug("\n1. Check id after parsing."); | 11 debug("\n1. Check id after parsing."); |
| 12 shouldBe('document.getElementById("a")', 'document.body'); | 12 shouldBe('document.getElementById("a")', 'document.body'); |
| 13 shouldBe('document.body.id', '"a"'); | 13 shouldBe('document.body.id', '"a"'); |
| 14 shouldBe('document.body.getAttributeNode("id").isId', 'true'); | |
| 15 shouldBe('document.body.getAttributeNode("id").textContent', '"a"'); | 14 shouldBe('document.body.getAttributeNode("id").textContent', '"a"'); |
| 16 | 15 |
| 17 debug("\n2. Change Attr.value."); | 16 debug("\n2. Change Attr.value."); |
| 18 document.body.getAttributeNode("id").value = "b"; | 17 document.body.getAttributeNode("id").value = "b"; |
| 19 shouldBe('document.getElementById("a")', 'null'); | 18 shouldBe('document.getElementById("a")', 'null'); |
| 20 shouldBe('document.getElementById("b")', 'document.body'); | 19 shouldBe('document.getElementById("b")', 'document.body'); |
| 21 shouldBe('document.body.getAttributeNode("id").textContent', '"b"'); | 20 shouldBe('document.body.getAttributeNode("id").textContent', '"b"'); |
| 22 | 21 |
| 23 debug("\n3. Change HTMLElement.id."); | 22 debug("\n3. Change HTMLElement.id."); |
| 24 document.body.id = "c"; | 23 document.body.id = "c"; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 var attrNode = document.createAttribute("id"); | 207 var attrNode = document.createAttribute("id"); |
| 209 attrNode.value = "p"; | 208 attrNode.value = "p"; |
| 210 document.body.setAttributeNode(attrNode); | 209 document.body.setAttributeNode(attrNode); |
| 211 shouldBe('document.getElementById("o")', 'null'); | 210 shouldBe('document.getElementById("o")', 'null'); |
| 212 shouldBe('document.getElementById("p")', 'document.body'); | 211 shouldBe('document.getElementById("p")', 'document.body'); |
| 213 shouldBe('document.body.id', '"p"'); | 212 shouldBe('document.body.id', '"p"'); |
| 214 shouldBe('document.body.getAttribute("id")', '"p"'); | 213 shouldBe('document.body.getAttribute("id")', '"p"'); |
| 215 </script> | 214 </script> |
| 216 </body> | 215 </body> |
| 217 </html> | 216 </html> |
| OLD | NEW |