Closed
Bug 173244
Opened 23 years ago
Closed 23 years ago
Wrong event type fired on CHECKBOX or RADIO INPUT changing in value of CHECKED attribute
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: Leland.M.George, Assigned: joki)
Details
Attachments
(1 file, 1 obsolete file)
|
2.58 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021007
Build Identifier: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021007
When an <INPUT TYPE="CHECKBOX"> or <INPUT TYPE="RADIO"> element is ticked by the
user, an event of type [on]change fires.
Reproducible: Always
Steps to Reproduce:
1. Set up an event listener to fire onchange when a checkbox or radio button is
ticked.
2. Tick the control
3.
Actual Results:
Event listener onchange fires, incorrectly.
Expected Results:
Event of type [on]change must not fire, as the value of the element has not
changed, and the element has not lost focus. See DOM 2 specification at
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-htmlevents
"The change event occurs when a control loses the input focus and its value has
been modified since gaining focus."
The [on]attrmodified event (domAttrModified) must fire instead, as required by
the specification: "DOMAttrModified [must be f]ired after an Attr has been
modified on a node. The target of this event is the Node whose Attr changed." See
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-mutationevents
Other browsers:
Both Netscape 4.x and Internet Explorer observe the quoted restrictions on event
type [on]change. Event type onpropertychange fires in Internet Explorer as
[on]attrmodified should in Mozilla. Netscape 4.x has no equivalent event type,
as far as I know, but a JavaScript watch could probably be set to create the
desired effect.
Search for duplicates:
Failed using string "input event" (criterion: "contains all words..."), turning
up related but distinct bugs 97058 and 111992.
Attachment is ready; will provide it as soon as Bugzilla permits me to.
| Reporter | ||
Comment 1•23 years ago
|
||
Also demonstrates two distinct bugs, which I'll file separately
| Reporter | ||
Comment 2•23 years ago
|
||
Also demonstrates two distinct bugs, which I'll file separately.
Please delete/ignore first attachment. I lost a variable when simplifying the
script.
Attachment #102146 -
Attachment is obsolete: true
| Reporter | ||
Comment 3•23 years ago
|
||
Comment on attachment 102158 [details]
Shows onchange firing, onattrmodified filing to fire.
See bug 173255 and bug 173270.
Comment 4•23 years ago
|
||
> DOMAttrModified [must be f]ired after an Attr has been
> modified on a node. The target of this event is the Node whose Attr changed.
Changing the presentational value of a form control does *not* change the HTML
value attribute. It changes the DOM value attribute on the element, but that is
not an Attr.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 5•23 years ago
|
||
Still, onchange shouldn't be firing: "The onchange event occurs when a control
loses the input focus _and _its value has been modified since gaining focus..."
(http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3)
You need to log in
before you can comment on or make changes to this bug.
Description
•