If you have an input element in the form with the same name as the native form property, then this element will be the shadow property native.
For example, consider the following view:
<form id = "test"> <input name="tagName" type="text" /> <input name="nodeName" type="text" /> </form>
The form element tagName and nodeName both usually return form . But in this case, the following code:
var f = document.getElementById("test"); console.log(f.tagName); console.log(f.nodeName); console.log(f["tagName"]); console.log(f["nodeName"]);
displayed:
<input name=β"tagName" type=β"text">β <input name=β"nodeName" type=β"text">β <input name=β"tagName" type=β"text">β <input name=β"nodeName" type=β"text">β
Is there a workaround for this (other than renaming the fields)? getAttribute works for things like name , action or method , but not for properties like nodeName or tagName .
The spell is here .
Something even more interesting : in this violin, I just write the form myself. This will usually show you HTML, but now Chrome just TypeError .
source share