| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <body> | |
| 4 <p>This tests setting the value of an attribute node after caching childNodes of
the attribute node.<br> | |
| 5 The cache should be cleared and childNodes[0].data should return the new value.<
br> | |
| 6 You should see PASS below:</p> | |
| 7 <div id="console"></div> | |
| 8 <script src="../../../resources/js-test.js"></script> | |
| 9 <script> | |
| 10 | |
| 11 var element = document.createElement('div'); | |
| 12 var nameAttrNode = document.createAttribute('name'); | |
| 13 var oldValue = document.createTextNode('oldName'); | |
| 14 nameAttrNode.appendChild(oldValue); | |
| 15 element.setAttributeNode(nameAttrNode); | |
| 16 document.body.appendChild(element); | |
| 17 | |
| 18 shouldBe("nameAttrNode.childNodes.length", '1'); | |
| 19 shouldBe('nameAttrNode.childNodes[0]', 'oldValue'); | |
| 20 shouldBe('nameAttrNode.childNodes[0].data', '"oldName"'); | |
| 21 | |
| 22 debug(''); | |
| 23 shouldBe("nameAttrNode.value = 'newName'; nameAttrNode.value", '"newName"'); | |
| 24 shouldNotBe("nameAttrNode.childNodes[0]", 'oldValue'); | |
| 25 shouldBe("nameAttrNode.childNodes[0].data", '"newName"'); | |
| 26 | |
| 27 </script> | |
| 28 </body> | |
| 29 </html> | |
| OLD | NEW |