You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
goog.dom.forms.getValueByName() will not work for inputs named item (or namedItem), because form.elements.item is native function (see http://jsfiddle.net/y4hL2k80/ and source code)
I am not aware how to fix it, because form.elements.namedItem(name) in MSIE will not return collection (form.elements in MSIE returns HtmlCollection whereas other browsers return HtmlFormControlsCollection and HtmlFormControlsCollection.namedItem('name') returns RadioNodeCollection containing all inputs, whereas HtmlCollection.namedItem('name') returns only the first one).
The text was updated successfully, but these errors were encountered:
Ya, an unfortunate side effect of using form.elements. The easy answer to this is "just don't use inputs named 'item'". Given that the fix is likely ugly, we haven't had anyone complain about this internally, and the work around is trivial, it's probably not worth the effort.
What we can do though is fail fast with a meaningful message (e.g., throw when elements returns a non-HTMLCollection or user passes the reserved names) or at the very least add a comment to the method. Just silently returning null now (which I assume is what it does) seems bad.
Feel free to re-open and/or send a PR with either of these and I'll review it.
goog.dom.forms.getValueByName()
will not work for inputs nameditem
(ornamedItem
), becauseform.elements.item
is native function (see http://jsfiddle.net/y4hL2k80/ and source code)I am not aware how to fix it, because
form.elements.namedItem(name)
in MSIE will not return collection (form.elements
in MSIE returnsHtmlCollection
whereas other browsers returnHtmlFormControlsCollection
andHtmlFormControlsCollection.namedItem('name')
returnsRadioNodeCollection
containing all inputs, whereasHtmlCollection.namedItem('name')
returns only the first one).The text was updated successfully, but these errors were encountered: