Closed Bug 277899 Opened 20 years ago Closed 20 years ago

properties 'readonly', 'disabled', 'value' of html:input type='text' do not modify corresponding attributes

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: surkov, Unassigned)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10.1 (ax)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10.1 (ax)

I think values of properites and values of corresponding attributes should be
concerted like in internet explorer.

Reproducible: Always
Invalid, see comments in bug 174229.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Ok. I agree 'value' attribute should not changed in accordance with
specification. But I can't find any references about not-changing 'disabled' and
'readonly' attributes in specification. In instance 'maxlength' and 'size'
attributes are changed when corresponding properties are changed.

I have question. Do you know what aim was pursuited when specification
developers defined such behaviour of 'value' attribute and 'value' property?
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Attached file Testcase
Oops! Sorry, I was too quick. This is a quick testcase.
You can test what happens when you change the dom properties of readonly and
disabled. The attribute 'readonly' and 'disabled' do change when you change the
readOnly and disabled dom properties. They change to null or '' (empty string).

Maybe noteworthy:
x.disabled='disabled' should give a javascript error, because the spec says it
should only accept a boolean, but Mozilla also accepts a string. This is
probably because of compatibility with other browsers.

> I have question. Do you know what aim was pursuited when specification
> developers defined such behaviour of 'value' attribute and 'value' property?
That's a question I have asked myself. I don't know the answer. I guess you
could ask it at the dom mailing list:
http://lists.w3.org/Archives/Public/www-dom/
So that means I still think this bug in invalid. ;)
martijn: js allows converting any values into a boolean, this is what
spidermonkey does...

this is invalid. properties and attributes are different things, they are not
equivalent. there is no reason to update an attribute randomly, just because the
property is set.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → INVALID
hm, per bug 277892 comment 7 this might actually not be invalid...
"value" should not be mapped to the attr, and the other two already are --
setting them changes the attr value.  So the bug is 1/3 invalid and 2/3
worksforme...
I think when I set property 'disabled' on 'true' that corresponding attribute
should have value 'true' not a empty string. It would be more comfortably.
The HTML "disabled" attribute is a boolean attribute -- that is, the only valid
value is "disabled", but a lot of HTML depends on it being present and having an
empty value to indicate disableness.  So giving it a value of "true" would be
wrong no matter what.  Between using an empty string and "disabled" is a tossup;
the former is probably more compatible with real-world HTML content.
verified.

comment 9 has a reasonable explanation for disabled and readOnly properties;
see http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-49531485 for "value"
attribute:

"When the type attribute of the element has the value "text", "file" or
"password", this represents the current contents of the corresponding form
control, in an interactive user agent. Changing this attribute changes the
contents of the form control, but does not change the value of the HTML value
attribute of the element. When the type attribute of the element has the value
"button", "hidden", "submit", "reset", "image", "checkbox" or "radio", this
represents the HTML value attribute of the element. See the value attribute
definition in HTML 4.01."

and
http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-value-INPUT:
"This attribute specifies the initial value of the control. It is optional
except when the type attribute has the value "radio" or "checkbox"."

Note the difference between DOM attributes (called properties in JavaScript) and
HTML attributes.
Status: RESOLVED → VERIFIED
To comment#3
>That's a question I have asked myself.

There is interesting article at xulplanet.com
http://xulplanet.com/ndeakin/archive/2004/12/22/
*** Bug 340012 has been marked as a duplicate of this bug. ***
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: