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