mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Accordion: call event.preventDefault() inside the _eventHandler() instead of in each individual event handler.
This commit is contained in:
parent
93d01208eb
commit
b22c69b949
15
ui/jquery.ui.accordion.js
vendored
15
ui/jquery.ui.accordion.js
vendored
@ -119,10 +119,8 @@ $.widget( "ui.accordion", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( options.event ) {
|
if ( options.event ) {
|
||||||
self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
|
self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion",
|
||||||
self._eventHandler( event );
|
$.proxy( self, "_eventHandler" ) );
|
||||||
event.preventDefault();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -217,7 +215,6 @@ $.widget( "ui.accordion", {
|
|||||||
case keyCode.SPACE:
|
case keyCode.SPACE:
|
||||||
case keyCode.ENTER:
|
case keyCode.ENTER:
|
||||||
this._eventHandler( event );
|
this._eventHandler( event );
|
||||||
event.preventDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( toFocus ) {
|
if ( toFocus ) {
|
||||||
@ -281,7 +278,11 @@ $.widget( "ui.accordion", {
|
|||||||
// we found a header to activate, just delegate to the event handler
|
// we found a header to activate, just delegate to the event handler
|
||||||
if ( active ) {
|
if ( active ) {
|
||||||
if ( active !== this.active[ 0 ] ) {
|
if ( active !== this.active[ 0 ] ) {
|
||||||
this._eventHandler( { target: active, currentTarget: active } );
|
this._eventHandler({
|
||||||
|
target: active,
|
||||||
|
currentTarget: active,
|
||||||
|
preventDefault: $.noop
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -320,6 +321,8 @@ $.widget( "ui.accordion", {
|
|||||||
clicked = $( event.currentTarget ),
|
clicked = $( event.currentTarget ),
|
||||||
clickedIsActive = clicked[0] === this.active[0];
|
clickedIsActive = clicked[0] === this.active[0];
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
if ( options.disabled ) {
|
if ( options.disabled ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user