#8040 closed bug (duplicate)
Bind two "change" events in IE will be fired twice
Reported by: | anonymous | Owned by: | dmethvin |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | event | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
In IE, when bind two "change" events to a textbox, and the first event will change the value of the textbox (e.g. toUpper, formatDate), then the second event will be fired twice.
Test code:
<input name="str1" id="str1" value="str1"> <script> function toUpper() { document.getElementById("str1").value = document.getElementById("str1").value.toUpperCase(); } function changeTest() { alert(1); } jQuery("#str1").bind("change", toUpper); jQuery("#str1").bind("change", changeTest); </script>
Test result:
- In IE(both IE6 and IE8), when input "abc" into str1, "1" will be alerted twice.
- In Firefox, it is OK, only alert once.
Change History (8)
comment:1 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Description: | modified (diff) |
Priority: | undecided → low |
Status: | new → open |
comment:3 Changed 12 years ago by
Version: | 1.4.4 → 1.5 |
---|
Test case adapted from #8269
http://jsfiddle.net/jitter/5zhP8/6/ without jQuery
http://jsfiddle.net/jitter/Z9EeB/ with jQuery
So not related to two handlers but that changing the value inside the change handler triggers another change event when using jQuery.
comment:5 Changed 12 years ago by
Milestone: | 1.next → 1.7 |
---|---|
Owner: | set to dmethvin |
Priority: | low → high |
Status: | open → assigned |
This should be fixed in 1.7, I'll recheck once it lands.
comment:6 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
comment:8 Changed 12 years ago by
Milestone: | 1.7 |
---|
Note: See
TracTickets for help on using
tickets.
This bug looks valid after a first quick check.
test case trying to simulate all of this without jQuery.
test case using jQuery.bind showing the double call behavior.
Maybe something is bogus in the special handling of the change event to make it bubble in IE.