<!DOCTYPE html>
<html>
<body>
<div id="testElements">
<form>
<input type="text" name="some">
<input type="text" name="length">
</form>
<form>
<select>
<option name="length">
<option name="some">
</select>
</form>
<table>
<tbody>
<tr id="another"><td></td></tr>
<tr id="length"><td></td></tr>
</tbody>
</table>
</div>
<script>

// We need to pre-fetch these values since including the script element inserts new elements.
documentAllLength = document.all.length;
documentAllSome = document.all['some'];
documentAll5 = document.all[5];
documentAll6 = document.all[6];

</script>
<script src="../../resources/js-test-pre.js"></script>
<script>

description("This test ensures the builtin length property of HTMLCollection's subclasses is not overridden by a named getter of the same name.");

var form = document.forms[0];
var select = document.querySelector('select');
var table = document.querySelector('table');
shouldBe("documentAllLength", "18");
shouldBe("documentAll5", "documentAllSome");
shouldBe("documentAll6.name", "'length'");

shouldBe("form.length", "form.elements[1]");
shouldBe("form.elements.length", "2");
shouldBe("form.elements[0]", "form.elements['some']");
shouldBe("form.elements[1].name", "'length'");

shouldBe("select.options.length", "2");
shouldBe("select.options[0].getAttribute('name')", "'length'");
shouldBe("select.options[1]", "select.options['some']");

shouldBe("table.rows.length", "2");
shouldBe("table.rows[0]", "table.rows['another']");
shouldBe("table.rows[1].id", "'length'");

document.getElementById('testElements').style.display = 'none';

var successfullyParsed = true;

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
