1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

LibWeb: Return a HTMLFormControlsCollection from HTMLFormElement element

Instead of a HTMLCollection
This commit is contained in:
Shannon Booth 2023-08-19 13:58:54 +12:00 committed by Andreas Kling
parent 27dd2a40ad
commit 9cf5b67162
5 changed files with 39 additions and 7 deletions

View file

@ -0,0 +1,24 @@
<form>
<input name="one" id="my-form-control" type="button" />
<input name="two" id="my-form-control" type="text" />
</form>
<script src="include.js"></script>
<script>
test(() => {
const formElements = document.forms[0].elements;
const radioNodeList = formElements.namedItem("my-form-control");
println(formElements.constructor.name);
println(radioNodeList.constructor.name);
println(radioNodeList.length);
println(radioNodeList[0].type);
println(radioNodeList[1].type);
const nonMatching = formElements.namedItem("no match");
println(nonMatching);
const singleElement = formElements.namedItem("two");
println(singleElement.constructor.name);
println(singleElement.type);
})
</script>