mirror of
https://github.com/jquery/jquery.git
synced 2026-02-04 04:35:03 -05:00
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:
committed by
Timmy Willison
parent
fd5facf1d1
commit
e83bc970f2
@@ -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" );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user