| <!DOCTYPE html> |
| <html> |
| <body> |
| <p>This tests setting the value of an attribute node after caching childNodes of the attribute node.<br> |
| The cache should be cleared and childNodes[0].data should return the new value.<br> |
| You should see PASS below:</p> |
| <div id="console"></div> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <script> |
| |
| var element = document.createElement('div'); |
| var nameAttrNode = document.createAttribute('name'); |
| var oldValue = document.createTextNode('oldName'); |
| nameAttrNode.appendChild(oldValue); |
| element.setAttributeNode(nameAttrNode); |
| document.body.appendChild(element); |
| |
| shouldBe("nameAttrNode.childNodes.length", '1'); |
| shouldBe('nameAttrNode.childNodes[0]', 'oldValue'); |
| shouldBe('nameAttrNode.childNodes[0].data', '"oldName"'); |
| |
| debug(''); |
| shouldBe("nameAttrNode.value = 'newName'; nameAttrNode.value", '"newName"'); |
| shouldNotBe("nameAttrNode.childNodes[0]", 'oldValue'); |
| shouldBe("nameAttrNode.childNodes[0].data", '"newName"'); |
| |
| </script> |
| </body> |
| </html> |