4 <script src=
"../../resources/js-test.js"></script>
7 <p>This test case ensures that nameNodeListCache should be invalidate when name attribute changes.
</p>
8 <div id=
"console"></div>
13 function createElement(type
, properties
)
15 var element
= document
.createElement(type
);
17 for (var i
in properties
)
18 if (properties
.hasOwnProperty(i
))
19 element
.setAttribute(i
,properties
[i
]);
21 document
.body
.appendChild(element
);
25 function createTwoElements(tagName
)
27 element1
= createElement(tagName
, {name
: 'fullname'});
28 element2
= createElement(tagName
, {name
: 'fullname'});
31 function runTest(tagName
)
33 shouldBe("createTwoElements('" + tagName
+ "'); document.getElementsByName('fullname').length", "2");
34 shouldBe("document.querySelector('" + tagName
+ "').setAttribute('name', 'changed-name'); document.getElementsByName('fullname').length", "1");
35 document
.body
.removeChild(element1
);
36 document
.body
.removeChild(element2
);
53 var successfullyParsed
= true;