@@ -86,7 +86,7 @@ $.widget( "mobile.dialog", $.mobile.widget, $.extend( {
8686 } ,
8787
8888 _setCloseBtn : function ( value ) {
89- var self = this , btn , location ;
89+ var self = this , btn , location , dst ;
9090
9191 if ( this . _headerCloseButton ) {
9292 this . _headerCloseButton . remove ( ) ;
@@ -95,21 +95,24 @@ $.widget( "mobile.dialog", $.mobile.widget, $.extend( {
9595 if ( value !== "none" ) {
9696 // Sanitize value
9797 location = ( value === "left" ? "left" : "right" ) ;
98- btn = $ ( "<a href='#' class='ui-btn-" + location + "' data-" + $ . mobile . ns + "icon='delete' data-" + $ . mobile . ns + "iconpos='notext'>" + this . options . closeBtnText + "</a>" ) ;
99- this . element . children ( ) . find ( ":jqmData(role='header')" ) . first ( ) . prepend ( btn ) ;
100- if ( $ . fn . buttonMarkup ) {
101- btn . buttonMarkup ( ) ;
102- }
103-
104- // this must be an anonymous function so that select menu dialogs can replace
105- // the close method. This is a change from previously just defining data-rel=back
106- // on the button and letting nav handle it
107- //
108- // Use click rather than vclick in order to prevent the possibility of unintentionally
109- // reopening the dialog if the dialog opening item was directly under the close button.
110- btn . bind ( "click" , function ( ) {
111- self . close ( ) ;
112- } ) ;
98+ dst = this . element . children ( ) . find ( ":jqmData(role='header')" ) . first ( ) ;
99+ btn = $ ( "<a></a>" , {
100+ "href" : "#" ,
101+ "class" : "ui-btn ui-btn-" + location +
102+ " ui-btn-" + $ . mobile . getInheritedTheme ( dst , "a" ) +
103+ " ui-icon ui-icon-shadow ui-icon-delete ui-btn-icon-notext"
104+ } )
105+ . text ( this . options . closeBtnText )
106+ . prependTo ( dst )
107+ // this must be an anonymous function so that select menu dialogs can replace
108+ // the close method. This is a change from previously just defining data-rel=back
109+ // on the button and letting nav handle it
110+ //
111+ // Use click rather than vclick in order to prevent the possibility of unintentionally
112+ // reopening the dialog if the dialog opening item was directly under the close button.
113+ . bind ( "click" , function ( ) {
114+ self . close ( ) ;
115+ } ) ;
113116
114117 this . _headerCloseButton = btn ;
115118 }
0 commit comments