Shimmed HTMLFormControlsCollection's elements property is incompatible
The elements member of a shimmed/wrapped HTMLFormControlsCollection (and presumably also HTMLCollection) only exposes elements by index, not by name. Also the namedItem() function isn't present. Is this intentional? I may be doing something stupid but this breaks code unrelated to web components on a page where the full webcomponentsjs polyfill is used. My specific use case is to have an instance of ProseMirror on a page which also has web components that need the Shadow Dom polyfill. When the polyfill is present ProseMirror breaks as it's trying to access form elements like this: form.elements["elementName"].
This alerts "false", "false":
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="../../webcomponentsjs/webcomponents.js"></script>
</head>
<body>
<form id="testForm">
<input name="field0">
<input name="field1">
</form>
<script>
window.addEventListener("WebComponentsReady", function(){
var el = document.querySelector('#testForm');
alert( typeof el.elements.namedItem === "function" );
alert( typeof el.elements["field0"] !== "undefined" );
});
</script>
</body>
</html>
Whereas this alerts "true", "true":
<!doctype html>
<html>
<head>
<title>Test</title>
</head>
<body>
<form id="testForm">
<input name="field0">
<input name="field1">
</form>
<script>
var el = document.querySelector('#testForm');
alert( typeof el.elements.namedItem === "function" );
alert( typeof el.elements["field0"] !== "undefined" );
</script>
</body>
</html>
Ah. Is this a duplicate of #217?
I'm going to say yes and tentatively close this as a duplicate :)