Bug Tracker

Ticket #5851 (closed bug: fixed)

Opened 5 years ago

Last modified 3 years ago

IE8 does not support the change event while using live

Reported by: matiasnu Owned by: brandon
Priority: major Milestone: 1.4.2
Component: event Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

According to  http://jquery14.com/day-01/jquery-14

The change and submit events work reliably across browsers for both normal and live events. We override the normal change and submit events in Internet Explorer and replace them with events that work identically to the other browsers.

---

This is not true for IE8, which seems to ignore live bound change events. (is I use bind, it works as advertised, though)

Attachments

testcase14-live.html Download (1.5 KB) - added by matiasnu 5 years ago.
Using live and change does not work in IE8
testcase14-bind.html Download (1.5 KB) - added by matiasnu 5 years ago.
Using bind and change works in IE8
changetest.html Download (361 bytes) - added by simonjefford 5 years ago.
Simpler test case
changetest141.html Download (340 bytes) - added by matiasnu 5 years ago.
Same test case but with 1.4.1

Change History

Changed 5 years ago by matiasnu

Using live and change does not work in IE8

Changed 5 years ago by matiasnu

Using bind and change works in IE8

comment:1 Changed 5 years ago by matiasnu

This text should also be changed until the bug is fixed; --- All Events Can Be Live Events

With the exception of ready, focus (use focusin instead), and blur (use focusout instead), all events that can be bound using .bind() can also be live events.

We’re very proud to count some addtional events amongst those supported by live(). 1.4 introduces cross-browser support for change, submit, focusin, focusout, mouseenter, and mouseleave via the event delegation in .live().

comment:2 Changed 5 years ago by simonjefford

I'm seeing the same thing here. Support for all events in live() across all the major browsers was the reason we just upgraded.

Changed 5 years ago by simonjefford

Simpler test case

comment:3 Changed 5 years ago by trixi

I have already posted a possible fix in the old discussion-group:

I have looked into this. The "trigger-line" in the testChange-function has to be changed from this:

return jQuery.event.trigger( e, arguments[1], this );

to this:

return jQuery.event.trigger( e, arguments[1], elem );

Additional It seems, that there was a typo. The condition above contains the following statement:

elem.type !== "select"

wich is always true. I think this can be deleted, without problems.

Some further infos about what is causing the bug, can be also found in the post:  http://groups.google.com/group/jquery-dev/browse_thread/thread/e74de6015020d160#msg_97e3d41e210ebcc8

comment:4 Changed 5 years ago by john

  • Status changed from new to closed
  • Resolution set to fixed

comment:5 Changed 5 years ago by matiasnu

  • Status changed from closed to reopened
  • Resolution fixed deleted

It seems that 1.4.1 does not detect the first change on an element in IE8 but the following changes work as expected. (attaching @simonjefford test case using 1.4.1 instead)

Changed 5 years ago by matiasnu

Same test case but with 1.4.1

comment:6 Changed 5 years ago by parrots

Problem seems to be in the testChange function. It's is using jQuery.data to cache the value of the input. The first time called it tries to get the previous value and it's undefined since it hasn't been cached yet. It returns without triggering the event because of the if check that fires because it's undefined. The next time through the cache has been created for the element with it's previous value and it can evaluate the change properly.

comment:7 Changed 5 years ago by parrots

Changing the beforeactivate function to the following seems to fix this issue in IE:

var elem = e.target;

if (elem.nodeName.toLowerCase() === "input"
elem.nodeName.toLowerCase() === "textarea") {

jQuery.data(elem, "_change_data", getVal(elem));

}

comment:8 Changed 5 years ago by john

  • Status changed from reopened to closed
  • Resolution set to fixed

comment:9 Changed 5 years ago by john

  • Version changed from 1.4 to 1.4.1
  • Milestone changed from 1.4.1 to 1.4.2

comment:10 Changed 4 years ago by anonymous

This seems to be broken again in IE9

Note: See TracTickets for help on using tickets.