In devtools, run these two lines:
1.
window.x = document.createElement("input");
x.type="text";
x.name="nm";
x.value="val";
x
// <input type="text" name="nm">
2.
window.x = document.createElement("input");
x.type="text";
x.name="nm";
x.setAttribute("value", "val");
x
// <input type="text" name="nm" value="val">
Why would it get printed differently? The value seems to be set properly in both cases. It seems like there's a disconnect between the property and the DOM attribute.
Also the getter for property .value
becomes different than the result of .getAttribute('value')
. I can setAttribute()
all day, but .value
returns old value.