Bug Tracker

Ticket #6514: live-event-trigger-fix.patch

File live-event-trigger-fix.patch, 1.4 KB (added by brianloveswords, 12 years ago)

QUnit test and fix for mouseenter and mouseleave not being triggerable when bound by live.

  • src/event.js

    diff --git a/src/event.js b/src/event.js
    index 45f2202..1d573a2 100644
    a b jQuery.each(["live", "die"], function( i, name ) { 
    964964
    965965                        preType = type;
    966966
    967                         if ( type === "focus" || type === "blur" ) {
     967                        if ( type === "focus" || type === "blur" || type === "mouseenter" || type === "mouseleave" ) {
    968968                                types.push( liveMap[ type ] + namespaces );
    969969                                type = type + namespaces;
    970970
  • test/unit/event.js

    diff --git a/test/unit/event.js b/test/unit/event.js
    index 9e1ac89..d7ef375 100644
    a b test("trigger() bubbling", function() { 
    588588});
    589589
    590590test("trigger(type, [data], [fn])", function() {
    591         expect(14);
     591        expect(16);
    592592
    593593        var handler = function(event, a, b, c) {
    594594                equals( event.type, "click", "check passed data" );
    test("trigger(type, [data], [fn])", function() { 
    605605                ok( true, "Native call was triggered" );
    606606        };
    607607
    608         // Triggers handlrs and native
     608       
     609        $elem.live('mouseenter', function(){
     610                ok( true, 'Trigger mouseenter bound by live' );
     611        });
     612
     613        $elem.live('mouseleave', function(){
     614                ok( true, 'Trigger mouseleave bound by live' );
     615        });
     616
     617        $elem.trigger('mouseenter');
     618
     619        $elem.trigger('mouseleave');
     620
     621        $elem.die('mouseenter');
     622
     623        $elem.die('mouseleave');
     624       
     625        // Triggers handlrs and native
    609626        // Trigger 5
    610627        $elem.bind("click", handler).trigger("click", [1, "2", "abc"]);
    611628