Skip to main content

Bug Tracker

Side navigation

#3980 closed enhancement (invalid)

Opened January 24, 2009 01:24AM UTC

Closed December 02, 2010 08:07AM UTC

.live() delegation can be friendly if it mimics the the propagation order

Reported by: iraebrasil Owned by: iraebrasil
Priority: low Milestone:
Component: event Version: 1.3.1
Keywords: live, delegation, order Cc:
Blocked by: Blocking:
Description

As discussed in the jquery-dev list on the topic: http://groups.google.com/group/jquery-dev/browse_thread/thread/d2900793205d58e/7d034f723cf8588c?hl=en&

I believe that the overhead is minimal in the proposed attached patch.

I've made a test case and also an unit test proposal.

1.3.1:

http://irae.pro.br/jquerytests/live.simulate.propagation-patched.html

1.3.1 with patch:

http://irae.pro.br/jquerytests/live.simulate.propagation-patched.html

Attachments (1)
  • live_ordering.diff (3.2 KB) - added by iraebrasil January 24, 2009 12:14PM UTC.

    sort live handlers to mimic natural propagation

Change History (7)

Changed January 24, 2009 01:28AM UTC by iraebrasil comment:1

Changed February 09, 2009 11:30PM UTC by john comment:2

resolution: → fixed
status: newclosed

Fixed in SVN rev [6192].

Changed April 01, 2009 12:22PM UTC by rajiv@manusis.com comment:3

resolution: fixed
status: closedreopened

The solution does not seem to work if the element uses .live() handler and parent using regular .click() handler. Try the following test case.


        // in testD <a> is bound without live
        $(function(){
            $('#testD li').click(function(event){
                $(this).css(
                    'background-color',
                    ($(this).css('background-color')==='rgb(255, 192, 203)'?'red':'rgb(255, 192, 203)')
                    );
            });
            $('#testD a').live("click", function(event){
                $(this).css(
                    'background-color',
                    ($(this).css('background-color')==='rgb(255, 255, 255)'?'silver':'rgb(255, 255, 255)')
                    );
                return false;
            });
        });

Changed June 16, 2009 08:55PM UTC by brandon comment:4

owner: brandon
status: reopenednew

Changed November 01, 2010 08:59PM UTC by rwaldron comment:5

owner: → iraebrasil
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!

Changed November 01, 2010 08:59PM UTC by rwaldron comment:6

milestone: 1.3.2
priority: majorlow

Changed December 02, 2010 08:07AM UTC by trac-o-bot comment:7

resolution: → invalid
status: pendingclosed

Automatically closed due to 14 days of inactivity.