Skip to main content

Bug Tracker

Side navigation

#4012 closed enhancement (fixed)

Opened January 28, 2009 06:22PM UTC

Closed June 22, 2010 03:24AM UTC

Last modified March 14, 2012 12:17PM UTC

Live() support for focus,blur,change,select,submit,reset events in IE

Reported by: henrib Owned by: brandon
Priority: major Milestone: 1.3.2
Component: event Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:
Description

Live() does not work for focus,blur,change,select,submit,reset because IE does not bubble these events.

I'm attaching a tentative fix (based on 'reglib') that make them bubble.

Attachments (1)
  • live4IE.js (3.5 KB) - added by henrib January 29, 2009 01:39PM UTC.

    The main file (requires adding jQuery.liveHandler = liveHandler in jQuery)

Change History (4)

Changed January 28, 2009 06:31PM UTC by henrib comment:1

The main idea of the fix is to add handlers to elements that do not bubble events that perform the bubbling by calling jQuery.liveHandler.

The main other points are:

A document handler on activate event that hooks input/form/texarea elements (it is guaranteed to happen first).

An expando (live4IE) that identifies the list of event handlers for the activated element allows to cleanup on blur (or deactivate if focus was not triggered).

A safeguard cleanup is performed as a defensive measure.

Changed January 29, 2009 12:20AM UTC by dmethvin comment:2

component: coreevent
owner: → brandon

That's a lot of code for inclusion in the core. AFAICT, though, IE8 doesn't fix any of the event bubbling issues so there is a chance we'll be dealing with it for several more years. Maybe you could release it as a plugin and see what level of interest there is for making this consistent?

Changed January 29, 2009 09:22AM UTC by henrib comment:3

I though about this but it feels kind of odd to make a plugin just for one browser class (aka IE). My impression was that the event delegation provided by the 'live' feature was just missing the last bit of IE support to be complete (supporting the commonly expected event types across all browsers).

As it stands, in a separate file, this allows to do a conditional include and only pay for that network load when "confronted" with IE but I agree this is un-jQuery-ish.

        <script src="jquery-1.3.1.js"></script>
        <!--[if IE]>
        <script src="live4IE.js"></script>
        <![endif]-->

I can try to shorten the code if you think this would help ("only" adds 3% to the total load now though).

Let me know & advise.

Changed June 22, 2010 03:24AM UTC by dmethvin comment:4

resolution: → fixed
status: newclosed

This was implemented in 1.4.