diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-11-15 22:29:24 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-11-26 10:28:21 +0100 |
commit | 83a9f219bf40ff834d660020bbfa7de550e48a0c (patch) | |
tree | a89cfc16f3fbe82f82b429acb71cb4edf85706d8 /ui | |
parent | 0848040d3ee041e443e2492c18a5a69c78ab9c12 (diff) | |
download | jquery-ui-83a9f219bf40ff834d660020bbfa7de550e48a0c.tar.gz jquery-ui-83a9f219bf40ff834d660020bbfa7de550e48a0c.zip |
Dialog: Use button widget for close button (was already listed as dependency)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.dialog.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index b860a8b18..055040b32 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -99,7 +99,6 @@ $.widget("ui.dialog", { uiDialog, // TODO should use this.uiDialogTitlebar instead uiDialogTitlebar, - uiDialogTitlebarClose, uiDialogTitle, uiDialogButtonPane; @@ -139,20 +138,21 @@ $.widget("ui.dialog", { }) .prependTo( uiDialog ); - uiDialogTitlebarClose = $( "<a href='#'></a>" ) - .addClass( "ui-dialog-titlebar-close ui-corner-all" ) - .attr( "role", "button" ) + this.uiDialogTitlebarClose = $( "<button></button>" ) + .button({ + label: options.closeText, + icons: { + primary: "ui-icon-closethick" + }, + text: false + }) + .addClass( "ui-dialog-titlebar-close" ) .click(function( event ) { event.preventDefault(); that.close( event ); }) .appendTo( uiDialogTitlebar ); - ( this.uiDialogTitlebarCloseText = $( "<span>" ) ) - .addClass( "ui-icon ui-icon-closethick" ) - .text( options.closeText ) - .appendTo( uiDialogTitlebarClose ); - uiDialogTitle = $( "<span>" ) .uniqueId() .addClass( "ui-dialog-title" ) @@ -183,10 +183,6 @@ $.widget("ui.dialog", { }); } - // TODO use button? or at least a button element, so that SPACE works? - this._hoverable( uiDialogTitlebarClose ); - this._focusable( uiDialogTitlebarClose ); - if ( options.draggable && $.fn.draggable ) { this._makeDraggable(); } @@ -575,7 +571,9 @@ $.widget("ui.dialog", { break; case "closeText": // ensure that we always pass a string - this.uiDialogTitlebarCloseText.text( "" + value ); + this.uiDialogTitlebarClose.button({ + label: "" + value + }); break; case "dialogClass": uiDialog |