Fixes #12736. Move hover event hack to deprecated.js for removal in 1.9. Closes gh-982.

Signed-off-by: Timmy Willison <timmywillisn@gmail.com>
This commit is contained in:
Greg Lavallee
2012-10-16 14:36:47 -04:00
committed by Timmy Willison
parent fd5facf1d1
commit e83bc970f2
4 changed files with 79 additions and 49 deletions

View File

@@ -107,4 +107,33 @@ if ( jQuery.browser ) {
ok(!!jQuery.attrFn, "attrFnPresent");
});
test("hover pseudo-event", function() {
expect(2);
var balance = 0;
jQuery( "#firstp" )
.on( "hovercraft", function() {
ok( false, "hovercraft is full of ills" );
})
.on( "click.hover.me.not", function( e ) {
equal( e.handleObj.namespace, "hover.me.not", "hover hack doesn't mangle namespaces" );
})
.bind("hover", function( e ) {
if ( e.type === "mouseenter" ) {
balance++;
} else if ( e.type === "mouseleave" ) {
balance--;
} else {
ok( false, "hover pseudo: unknown event type "+e.type );
}
})
.trigger("click")
.trigger("mouseenter")
.trigger("mouseleave")
.unbind("hover")
.trigger("mouseenter");
equal( balance, 0, "hover pseudo-event" );
});
}

View File

@@ -798,8 +798,8 @@ test("unbind(eventObject)", function() {
assert( 0 );
});
test("hover() and hover pseudo-event", function() {
expect(3);
test("hover() mouseenter mouseleave", function() {
expect(1);
var times = 0,
handler1 = function( event ) { ++times; },
@@ -817,30 +817,6 @@ test("hover() and hover pseudo-event", function() {
equal( times, 4, "hover handlers fired" );
var balance = 0;
jQuery( "#firstp" )
.on( "hovercraft", function() {
ok( false, "hovercraft is full of ills" );
})
.on( "click.hover.me.not", function( e ) {
equal( e.handleObj.namespace, "hover.me.not", "hover hack doesn't mangle namespaces" );
})
.bind("hover", function( e ) {
if ( e.type === "mouseenter" ) {
balance++;
} else if ( e.type === "mouseleave" ) {
balance--;
} else {
ok( false, "hover pseudo: unknown event type "+e.type );
}
})
.trigger("click")
.trigger("mouseenter")
.trigger("mouseleave")
.unbind("hover")
.trigger("mouseenter");
equal( balance, 0, "hover pseudo-event" );
});
test("mouseover triggers mouseenter", function() {