Ticket #3127: hover[5762].diff
File hover[5762].diff, 2.4 KB (added by , 14 years ago) |
---|
-
jquery/src/event.js
363 363 setup: function() { 364 364 // Make sure the ready event is setup 365 365 bindReady(); 366 return;367 366 }, 368 367 369 teardown: function() { return; } 370 }, 368 teardown: function() { } 369 } 370 } 371 }; 371 372 372 mouseenter: { 373 setup: function() { 374 if ( jQuery.browser.msie ) return false; 375 jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler); 376 return true; 377 }, 378 379 teardown: function() { 380 if ( jQuery.browser.msie ) return false; 381 jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler); 382 return true; 383 }, 384 385 handler: function(event) { 386 // If we actually just moused on to a sub-element, ignore it 387 if ( withinElement(event, this) ) return true; 388 // Execute the right handlers by setting the event type to mouseenter 389 event.type = "mouseenter"; 390 return jQuery.event.handle.apply(this, arguments); 373 if( !jQuery.browser.msie ) 374 jQuery.each({ 375 mouseover : 'mouseenter', 376 mouseout : 'mouseleave' 377 }, function( orig, fix ){ 378 var event = jQuery.event; 379 380 function handler( e ) { 381 // If we didn't actually moused on to a sub-element 382 if ( !withinElement(e, this) ){ 383 // Fix the event type and execute the right handlers 384 e.type = "mouseenter"; 385 return event.handle.apply( this, arguments ); 391 386 } 392 } ,393 394 mouseleave:{387 } 388 389 event.special[ fix ] = { 395 390 setup: function() { 396 if ( jQuery.browser.msie ) return false; 397 jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler); 398 return true; 391 event.add( this, orig, handler ); 399 392 }, 400 393 401 394 teardown: function() { 402 if ( jQuery.browser.msie ) return false;403 jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);404 return true;405 },395 event.remove( this, orig, handler ); 396 } 397 }; 398 }); 406 399 407 handler: function(event) {408 // If we actually just moused on to a sub-element, ignore it409 if ( withinElement(event, this) ) return true;410 // Execute the right handlers by setting the event type to mouseleave411 event.type = "mouseleave";412 return jQuery.event.handle.apply(this, arguments);413 }414 }415 }416 };417 418 400 jQuery.fn.extend({ 419 401 bind: function( type, data, fn ) { 420 402 return type == "unload" ? this.one(type, data, fn) : this.each(function(){