Closed Bug 267357 Opened 20 years ago Closed 20 years ago

DOM value of text field value attribute vs user edit

Categories

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

Other Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: danm.moz, Unassigned)

Details

Attachments

(1 file)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20041101
Firefox/1.0RC2

Editing a text field causes a disconnect between its displayed value and its
value to script. textElement.getAttribute always returns the value last set by
textElement.setAttribute, ignoring user edits. Further, textElement.setAttribute
will change the text displayed in the text element, but not after the user has
edited the text field.

Originally reported by brilliantcrank,
http://forums.mozillazine.org/viewtopic.php?t=154454
Attached file testcase
Oops. I got the attribution wrong. Reported by rjm,
http://forums.mozillazine.org/viewtopic.php?t=154210
(In reply to comment #0)
> Editing a text field causes a disconnect between its displayed value and its
> value to script. textElement.getAttribute always returns the value last set by
> textElement.setAttribute, ignoring user edits.

It's supposed to work that way.  The attribute is equivalent to the
.defaultValue property.

http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-6043025

> Further, textElement.setAttribute
> will change the text displayed in the text element, but not after the user has
> edited the text field.

This seems reasonable, but I don't think the spec says either way.  What do
other implementations do?
Yeah, all per design. There's been *tons* of bugs about this, trying to balance
our implementation between what's expected on the web, what the standards say,
and what IE does. Marking INVALID.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Guess I should heed my own advice about looking for closed bugs before filing
new ones :) Another one of those W3 vs IE things, eh? Gotta say, IE's
interpretation makes more sense to me. Shutting up now.
Note that the current proposed WHATWG prose disagrees with Mozilla here:

   http://whatwg.org/specs/web-forms/current-work/#the-defaultvalue

It isn't final, I'm awaiting comments from a few people (hyatt in particular)
before having any sort of firm opinion on this. If you want it to change please
mail the whatwg@whatwg.org list explaining what you think it should say, and
why. Compatibility with IE without losing sanity is an important priority here.
(Strict compatibility with IE is impossible without losing sanity here.)
Actually looks like we're going with what Mozilla does here after all. Trying to
be compatible with IE any more than Mozilla is seems nigh on impossible.
Component: DOM: Core → 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

Creator:
Created:
Updated:
Size: