Skip to content
Browse files

[dialog] Prevent the click-handler for "Close" acting twice - Fixes: #…

  • Loading branch information...
1 parent 98b349e commit fa1d511ca8c0cdffba832b1697e537b8462d8d90 @gabrielschulhof gabrielschulhof committed Apr 18, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 js/jquery.mobile.dialog.js
View
7 js/jquery.mobile.dialog.js
@@ -18,6 +18,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {
var self = this,
$el = this.element,
headerCloseButton = $( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText + "</a>" ),
+ closeButtonNotYetClicked = true,
dialogWrap = $("<div/>", {
"role" : "dialog",
"class" : "ui-dialog-contain ui-corner-all ui-overlay-shadow"
@@ -46,7 +47,10 @@ $.widget( "mobile.dialog", $.mobile.widget, {
// Use click rather than vclick in order to prevent the possibility of unintentionally
// reopening the dialog if the dialog opening item was directly under the close button.
headerCloseButton.bind( "click", function() {
- self.close();
+ if ( closeButtonNotYetClicked ) {
+ closeButtonNotYetClicked = false;
+ self.close();
+ }
});
/* bind events
@@ -68,6 +72,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {
})
.bind( "pagehide", function( e, ui ) {
$( this ).find( "." + $.mobile.activeBtnClass ).removeClass( $.mobile.activeBtnClass );
+ closeButtonNotYetClicked = true;
})
// Override the theme set by the page plugin on pageshow
.bind( "pagebeforeshow", function(){

0 comments on commit fa1d511

Please sign in to comment.
Something went wrong with that request. Please try again.