Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / getelementsbyname-invalidation-cache.html
blobdd56ecb2abf7970e57e67031e61d974fb25e00ab
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p>This test case ensures that nameNodeListCache should be invalidate when name attribute changes.</p>
8 <div id="console"></div>
9 <script>
10 var element1;
11 var element2;
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);
22 return 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);
37 debug('');
40 runTest('a');
41 runTest('applet');
42 runTest('embed');
43 runTest('section');
44 runTest('frame');
45 runTest('form');
46 runTest('iframe');
47 runTest('img');
48 runTest('map');
49 runTest('meta');
50 runTest('object');
51 runTest('param');
53 var successfullyParsed = true;
54 </script>
55 </body>
56 </html>