blob: dd56ecb2abf7970e57e67031e61d974fb25e00ab [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p>This test case ensures that nameNodeListCache should be invalidate when name attribute changes.</p>
<div id="console"></div>
<script>
var element1;
var element2;
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);
return 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);
debug('');
}
runTest('a');
runTest('applet');
runTest('embed');
runTest('section');
runTest('frame');
runTest('form');
runTest('iframe');
runTest('img');
runTest('map');
runTest('meta');
runTest('object');
runTest('param');
var successfullyParsed = true;
</script>
</body>
</html>