<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test-pre.js"></script>
<script>

description("This tests that node lists returned by getElementsByTagNameNS are invalidated upon child node changes.");

var container = document.createElement('div');

function appendImageWithId(id) {
    container.appendChild(document.createElement('img'));
    container.lastChild.id = id;
}

var nodeList;
var namespace = document.body.namespaceURI;
shouldBe("appendImageWithId('firstImage'); nodeList = container.getElementsByTagNameNS(namespace, 'img'); nodeList.item(0).id", "'firstImage'");
shouldBe("nodeList.length", "1");
shouldBe("appendImageWithId('secondImage'); container.removeChild(container.firstChild); nodeList.item(0).id", "'secondImage'");
shouldBe("nodeList.length", "1");

</script>
</body>
</html>
