44* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
55* Note: Code is in draft form and is subject to change
66*/
7- ( function ( $ , undefined ) {
7+ ( function ( $ , undefined ) {
88$ . widget ( "mobile.dialog" , $ . mobile . widget , {
99 options : {
1010 closeBtnText : "Close"
1111 } ,
12- _create : function ( ) {
13- var self = this ,
14- $el = self . element ;
12+ _create : function ( ) {
13+ var $el = this . element ;
1514
1615 /* class the markup for dialog styling */
17- this . element
16+ $el
1817 //add ARIA role
19- . attr ( "role" , "dialog" )
20- . addClass ( ' ui-page ui-dialog ui-body-a' )
18+ . attr ( "role" , "dialog" )
19+ . addClass ( " ui-page ui-dialog ui-body-a" )
2120 . find ( ":jqmData(role=header)" )
22- . addClass ( ' ui-corner-top ui-overlay-shadow' )
21+ . addClass ( " ui-corner-top ui-overlay-shadow" )
2322 . prepend ( "<a href='#' data-" + $ . mobile . ns + "icon='delete' data-" + $ . mobile . ns + "rel='back' data-" + $ . mobile . ns + "iconpos='notext'>" + this . options . closeBtnText + "</a>" )
2423 . end ( )
25- . find ( '.ui-content:not([class*="ui-body-"])' )
26- . addClass ( 'ui-body-c' )
24+ . find ( '.ui-content:not([class*="ui-body-"])' )
25+ . addClass ( 'ui-body-c' )
2726 . end ( )
2827 . find ( ".ui-content,:jqmData(role='footer')" )
2928 . last ( )
30- . addClass ( ' ui-corner-bottom ui-overlay-shadow' ) ;
29+ . addClass ( " ui-corner-bottom ui-overlay-shadow" ) ;
3130
3231 /* bind events
3332 - clicks and submits should use the closing transition that the dialog opened with
3433 unless a data-transition is specified on the link/form
3534 - if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
3635 */
37- this . element
38- . bind ( "vclick submit" , function ( e ) {
39- var $targetel ;
40- if ( e . type == "vclick" ) {
41- $targetel = $ ( e . target ) . closest ( "a" ) ;
42- }
43- else {
44- $targetel = $ ( e . target ) . closest ( "form" ) ;
45- }
36+ $el
37+ . bind ( "vclick submit" , function ( e ) {
38+ var $target = $ ( e . target ) . closest ( e . type === "vclick" ? "a" : "form" ) ;
4639
47- if ( $targetel . length && ! $targetel . jqmData ( "transition" ) ) {
40+ if ( $target . length && ! $target . jqmData ( "transition" ) ) {
4841 var active = $ . mobile . urlHistory . getActive ( ) || { } ;
49- $targetel
50- . attr ( "data-" + $ . mobile . ns + "transition" , ( active . transition || $ . mobile . defaultDialogTransition ) )
51- . attr ( "data-" + $ . mobile . ns + "direction" , "reverse" ) ;
42+ $target
43+ . attr ( "data-" + $ . mobile . ns + "transition" , ( active . transition || $ . mobile . defaultDialogTransition ) )
44+ . attr ( "data-" + $ . mobile . ns + "direction" , "reverse" ) ;
5245 }
5346 } ) ;
54-
5547 } ,
5648
5749 //close method goes back in history
58- close : function ( ) {
50+ close : function ( ) {
5951 window . history . back ( ) ;
6052 }
6153} ) ;
62- } ) ( jQuery ) ;
54+ } ) ( jQuery ) ;
0 commit comments