]> source.dussan.org Git - jquery.git/commitdiff
Landed the rest of the liveHandler rewrite that takes advantage of the new closest...
authorjeresig <jeresig@gmail.com>
Thu, 3 Dec 2009 16:15:26 +0000 (11:15 -0500)
committerjeresig <jeresig@gmail.com>
Thu, 3 Dec 2009 16:15:26 +0000 (11:15 -0500)
src/event.js

index 24e5ef11df583d7cc3fb5d0ca2c594e110bee4c5..7b765ce8a7d3a31f07dc6d976fa76e31a91a9b39 100644 (file)
@@ -756,23 +756,20 @@ function liveHandler( event ) {
        for ( j in live ) {
                if ( live[j].live === event.type ) {
                        selectors.push( live[j].selector );
+               } else {
+                       delete live[j];
                }
        }
 
-       console.log( event.type, selectors+"" );
-
-       // TODO: Make sure that duplicate selectors aren't run
        match = jQuery( event.target ).closest( selectors, event.currentTarget );
 
-       console.log( "match", match, selectors+"" );
-
        for ( i = 0, l = match.length; i < l; i++ ) {
                for ( j in live ) {
                        fn = live[j];
                        elem = match[i].elem;
                        related = null;
 
-                       if ( match[i].selector === fn.selector) {
+                       if ( match[i].selector === fn.selector ) {
                                // Those two events require additional checking
                                if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) {
                                        related = jQuery( event.relatedTarget ).closest( fn.selector )[0];
@@ -785,8 +782,6 @@ function liveHandler( event ) {
                }
        }
 
-       console.log( "elems", elems );
-
        for ( i = 0, l = elems.length; i < l; i++ ) {
                match = elems[i];
                event.currentTarget = match.elem;