Skip to content
Permalink
Browse files

Accordion: call event.preventDefault() inside the _eventHandler() ins…

…tead of in each individual event handler.
  • Loading branch information...
scottgonzalez committed Jan 13, 2011
1 parent 93d0120 commit b22c69b949b6d807af0124fa481017bfff57f37b
Showing with 9 additions and 6 deletions.
  1. +9 −6 ui/jquery.ui.accordion.js
@@ -119,10 +119,8 @@ $.widget( "ui.accordion", {
}

if ( options.event ) {
self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
self._eventHandler( event );
event.preventDefault();
});
self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion",
$.proxy( self, "_eventHandler" ) );
}
},

@@ -217,7 +215,6 @@ $.widget( "ui.accordion", {
case keyCode.SPACE:
case keyCode.ENTER:
this._eventHandler( event );
event.preventDefault();
}

if ( toFocus ) {
@@ -281,7 +278,11 @@ $.widget( "ui.accordion", {
// we found a header to activate, just delegate to the event handler
if ( active ) {
if ( active !== this.active[ 0 ] ) {
this._eventHandler( { target: active, currentTarget: active } );
this._eventHandler({
target: active,
currentTarget: active,
preventDefault: $.noop
});
}
return;
}
@@ -320,6 +321,8 @@ $.widget( "ui.accordion", {
clicked = $( event.currentTarget ),
clickedIsActive = clicked[0] === this.active[0];

event.preventDefault();

if ( options.disabled ) {
return;
}

0 comments on commit b22c69b

Please sign in to comment.
You can’t perform that action at this time.