Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Dialog: Make sure close button inherits header theme.

When the button is added to the dialog during _create(), the header is not yet enhanced, so getInheritedTheme() works incorrectly. OTOH, since the header is not enhanced, the button need not be enhanced during create either, since it will be enhanced later when the header is itself enhanced. The button only needs to be enhanced when the option is being set on-the-fly.
  • Loading branch information...
commit 767a36df690f85328226bd614d6df86e4b4cabdc 1 parent 942ea92
@gabrielschulhof gabrielschulhof authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 js/widgets/dialog.js
View
9 js/widgets/dialog.js
@@ -62,6 +62,10 @@ $.widget( "mobile.dialog", $.mobile.widget, {
}
});
+ $.extend( this, {
+ _createComplete: false
+ });
+
this._setCloseBtn( this.options.closeBtn );
},
@@ -76,10 +80,11 @@ $.widget( "mobile.dialog", $.mobile.widget, {
// Sanitize value
location = ( value === "left" ? "left" : "right" );
btn = $( "<a href='#' class='ui-btn-" + location + "' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText + "</a>" );
- if ( $.fn.buttonMarkup ) {
+ this.element.children().find( ":jqmData(role='header')" ).prepend( btn );
+ if ( this._createComplete && $.fn.buttonMarkup ) {
btn.buttonMarkup();
}
- this.element.children().find( ":jqmData(role='header')" ).prepend( btn );
+ this._createComplete = true;
// this must be an anonymous function so that select menu dialogs can replace
// the close method. This is a change from previously just defining data-rel=back
Please sign in to comment.
Something went wrong with that request. Please try again.