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
{{ message }}
Repository navigation
"The value IDL attribute allows scripts to manip..." #628
The value IDL attribute allows scripts to manipulate the value of an input element. The attribute is in one of the following modes, which define its behaviour:
When the HTML spec talks about this value IDL attribute, is it the same as the attributes field in Element as defined by the DOM spec? Should every mutation of the value IDL attribute be done through the setAttribute method for an Element?
IDL attributes are the script-exposed attributes/properties on interfaces like HTMLInputElement including non-elements Document.
A content attribute is an attribute in the DOM sense, i.e. something that an element has, as in <html lang="en">.
"Some IDL attributes are defined to reflect a particular content attribute. This means that on getting, the IDL attribute returns the current value of the content attribute, and on setting, the IDL attribute changes the value of the content attribute to the given value." (source)
For HTMLInputElement, value is not a reflected attribute, it has state independent of the content attribute. defaultValue, however, does reflect the value content attribute, if needed.
So I'm suspecting that this test is perhaps wrong? The element with an ID of "r1" is set with a value here in an earlier test, and then an attempt to reset it was done by using removeAttribute on the "r1" element.
This tests a behavior I didn't know about, sorry. If I had read the spec just a little beyond what you originally quoted, I would have seen that in the default and default/on states, the IDL attribute setter does indeed set the content attribute. And, for type=checkbox and type=radio, the state is default/on.
Activity
foolip commentedon Feb 5, 2016
We have:
HTMLInputElementincluding non-elementsDocument.<html lang="en">.For
HTMLInputElement,valueis not a reflected attribute, it has state independent of the content attribute.defaultValue, however, does reflect thevaluecontent attribute, if needed.Hope that helps!
See also #551 for a similar kind of question.
KiChjang commentedon Feb 5, 2016
So I'm suspecting that this test is perhaps wrong? The element with an ID of "r1" is set with a value here in an earlier test, and then an attempt to reset it was done by using
removeAttributeon the "r1" element.foolip commentedon Feb 7, 2016
It looks like that part of the test was added by @djc in web-platform-tests/wpt@aeec0fc in response to the 193ac0a spec change.
This tests a behavior I didn't know about, sorry. If I had read the spec just a little beyond what you originally quoted, I would have seen that in the default and default/on states, the IDL attribute setter does indeed set the content attribute. And, for
type=checkboxandtype=radio, the state is default/on.domenic commentedon Feb 29, 2016
Closing this since there doesn't seem to be a spec bug here. Let me know if I missed something...