<!DOCTYPE html>
<html>
<body>
<div id="container">
<form id="someForm"></form>
<input type="text" name="someName" form="someForm">
</div>
<script src="../../resources/js-test-pre.js"></script>
<script>

description("Tests form.elements is invalidated when input element's form attribute is changed.");

var input = document.querySelector('input');
var collection;
evalAndLog("collection = document.getElementById('someForm').elements;");
shouldBe("collection.length", "1");
shouldBe("collection.length; input.setAttribute('form', 'otherForm'); collection.length", "0");
shouldBe("collection.length; input.setAttribute('form', 'someForm'); collection.length", "1");

container.style.display = 'none';

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