Skip to content

"The value IDL attribute allows scripts to manip..." #628

Closed

Description

@KiChjang

https://html.spec.whatwg.org/multipage/forms.html#common-input-element-apis

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?

Activity

  1. foolip commented on Feb 5, 2016

    @foolip
    Member

    We have:

    • 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.

    Hope that helps!

    See also #551 for a similar kind of question.

  2. KiChjang commented on Feb 5, 2016

    @KiChjang
    MemberAuthor

    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.

  3. foolip commented on Feb 7, 2016

    @foolip
    Member

    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=checkbox and type=radio, the state is default/on.

  4. domenic commented on Feb 29, 2016

    @domenic
    Member

    Closing this since there doesn't seem to be a spec bug here. Let me know if I missed something...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions