mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #13993. Save result of native inline handlers. Close gh-1368.
This commit is contained in:
parent
4375750067
commit
3bcd04f528
@ -312,10 +312,13 @@ jQuery.event = {
|
|||||||
|
|
||||||
// Native handler
|
// Native handler
|
||||||
handle = ontype && cur[ ontype ];
|
handle = ontype && cur[ ontype ];
|
||||||
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
|
if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
|
||||||
|
event.result = handle.apply( cur, data );
|
||||||
|
if ( event.result === false ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
event.type = type;
|
event.type = type;
|
||||||
|
|
||||||
// If nobody prevented the default action, do it now
|
// If nobody prevented the default action, do it now
|
||||||
|
@ -2613,3 +2613,11 @@ test( "String.prototype.namespace does not cause trigger() to throw (#13360)", f
|
|||||||
equal( errored, false, "trigger() did not throw exception" );
|
equal( errored, false, "trigger() did not throw exception" );
|
||||||
delete String.prototype.namespace;
|
delete String.prototype.namespace;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "Inline event result is returned (#13993)", function() {
|
||||||
|
expect( 1 );
|
||||||
|
|
||||||
|
var result = jQuery("<p onclick='return 42'>hello</p>").triggerHandler("click");
|
||||||
|
|
||||||
|
equal( result, 42, "inline handler returned value" );
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user