aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.accordion.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-01-13 16:45:21 -0500
committerScott González <scott.gonzalez@gmail.com>2011-01-13 16:45:21 -0500
commitb22c69b949b6d807af0124fa481017bfff57f37b (patch)
treefe141bcdbad8d171662d1ea5f773d73fccae6b4c /ui/jquery.ui.accordion.js
parent93d01208ebeaaabd7da2800d894a7d4e88e33db7 (diff)
downloadjquery-ui-b22c69b949b6d807af0124fa481017bfff57f37b.tar.gz
jquery-ui-b22c69b949b6d807af0124fa481017bfff57f37b.zip
Accordion: call event.preventDefault() inside the _eventHandler() instead of in each individual event handler.
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r--ui/jquery.ui.accordion.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 5fa4b1aee..8b7c1f3a4 100644
--- a/ui/jquery.ui.accordion.js
+++ b/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;
}