| <script src="../../resources/js-test-pre.js"></script> |
| <p>This test case ensures that nameNodeListCache should be invalidate when name attribute changes.</p> |
| function createElement(type, properties) |
| var element = document.createElement(type); |
| for (var i in properties) |
| if (properties.hasOwnProperty(i)) |
| element.setAttribute(i,properties[i]); |
| document.body.appendChild(element); |
| function createTwoElements(tagName) |
| element1 = createElement(tagName, {name: 'fullname'}); |
| element2 = createElement(tagName, {name: 'fullname'}); |
| function runTest(tagName) |
| shouldBe("createTwoElements('" + tagName + "'); document.getElementsByName('fullname').length", "2"); |
| shouldBe("document.querySelector('" + tagName + "').setAttribute('name', 'changed-name'); document.getElementsByName('fullname').length", "1"); |
| document.body.removeChild(element1); |
| document.body.removeChild(element2); |
| var successfullyParsed = true; |
| <script src="../../resources/js-test-post.js"></script> |