mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #11130: Don't neglect the data arg when event-map is passed.
This commit is contained in:
parent
d828996478
commit
c0da49ff37
@ -867,9 +867,9 @@ jQuery.fn.extend({
|
||||
// Types can be a map of types/handlers
|
||||
if ( typeof types === "object" ) {
|
||||
// ( types-Object, selector, data )
|
||||
if ( typeof selector !== "string" ) {
|
||||
if ( typeof selector !== "string" ) { // && selector != null
|
||||
// ( types-Object, data )
|
||||
data = selector;
|
||||
data = data || selector;
|
||||
selector = undefined;
|
||||
}
|
||||
for ( type in types ) {
|
||||
|
@ -2616,7 +2616,7 @@ test(".on and .off, selective mixed removal (#10705)", function() {
|
||||
ok( true, "triggered " + e.type );
|
||||
};
|
||||
|
||||
jQuery( '<p>Strange Pursuit</p>' )
|
||||
jQuery( "<p>Strange Pursuit</p>" )
|
||||
.on( "click", timingx )
|
||||
.on( "click.duty", timingx )
|
||||
.on( "click.now", timingx )
|
||||
@ -2631,6 +2631,22 @@ test(".on and .off, selective mixed removal (#10705)", function() {
|
||||
.trigger( "click" ); // 0
|
||||
});
|
||||
|
||||
test(".on( event-map, null-selector, data ) #11130", function() {
|
||||
|
||||
expect( 1 );
|
||||
|
||||
var $p = jQuery("<p>Strange Pursuit</p>"),
|
||||
data = "bar",
|
||||
map = {
|
||||
"foo": function( event ) {
|
||||
equal( event.data, "bar", "event.data correctly relayed with null selector" );
|
||||
$p.remove();
|
||||
}
|
||||
};
|
||||
|
||||
$p.on( map, null, data ).trigger("foo");
|
||||
});
|
||||
|
||||
test("delegated events quickIs", function() {
|
||||
expect(14);
|
||||
var markup = jQuery(
|
||||
|
Loading…
Reference in New Issue
Block a user