This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24949 - Should 'change' fire for programmatic changes?
Summary: Should 'change' fire for programmatic changes?
Status: RESOLVED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-05 22:13 UTC by Travis Leithead [MSFT]
Modified: 2016-04-25 15:39 UTC (History)
4 users (show)

See Also:


Attachments

Description Travis Leithead [MSFT] 2014-03-05 22:13:18 UTC
HI,
I would like to know expected behaviour for below 
should  'change' event fire when the text field value is changed programatically ?
Ex:
<html>
<body>
<input onkeyup="this.value = this.value.toUpperCase()" onchange="console.log('onchange dispatched');"/>
</body>
</html>
In this case when user updates the value, its get programatically modifed again due to keyup handler.
I see different behaviour in different browser.
Does change event be fired when programatically changed on specific to keyup handler.
 
Thanks in Advance,
Gnana
Comment 1 Mounir Lamouri 2014-03-06 15:34:02 UTC
Shouldn't the change event be fired if the value changes between the user focusing the element and the user blurring the element for <input type='text'>?
Comment 2 Travis Leithead [MSFT] 2016-04-25 15:39:31 UTC
HTML5.1 Bugzilla Bug Triage: Works for me.

Yes, per 4.10.5.5. Common event behaviors, I believe the spec is [fairly] clear that 'change' fires after a 'commit' action or on blur (after being focused). In one of the examples, input from the user typing does not fire it until focus is lost.

If this resolution is not satisfactory, please copy the relevant bug details/proposal into a new issue at the W3C HTML5 Issue tracker: https://github.com/w3c/html/issues/new where it will be re-triaged. Thanks!