Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#4012 closed enhancement (fixed)

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 10 years ago.
The main file (requires adding jQuery.liveHandler = liveHandler in jQuery)

Download all attachments as: .zip

Change History (5)

comment:1 Changed 10 years ago by henrib

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.

comment:2 Changed 10 years ago by dmethvin

Component: coreevent
Owner: set to 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?

comment:3 Changed 10 years ago by henrib

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 10 years ago by henrib

Attachment: live4IE.js added

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

comment:4 Changed 9 years ago by dmethvin

Resolution: fixed
Status: newclosed

This was implemented in 1.4.

Note: See TracTickets for help on using tickets.