Skip to content

Commit ab76ac3

Browse files
committed
jquery.mobile.dialog.js: Whitespace changes and string delimiters, bringing this up to jQuery coding standards. Renamed one memory variable for legibility and clarity.
Signed-off-by: Steven Black <steveb@stevenblack.com>
1 parent a4ee2d5 commit ab76ac3

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

js/jquery.mobile.dialog.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,56 @@
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(){
12+
_create: function() {
1313
var self = this,
1414
$el = self.element;
1515

1616
/* class the markup for dialog styling */
1717
this.element
1818
//add ARIA role
19-
.attr("role","dialog")
20-
.addClass('ui-page ui-dialog ui-body-a')
19+
.attr( "role", "dialog" )
20+
.addClass( "ui-page ui-dialog ui-body-a" )
2121
.find( ":jqmData(role=header)" )
22-
.addClass('ui-corner-top ui-overlay-shadow')
22+
.addClass( "ui-corner-top ui-overlay-shadow" )
2323
.prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText +"</a>" )
2424
.end()
25-
.find('.ui-content:not([class*="ui-body-"])')
26-
.addClass('ui-body-c')
25+
.find( '.ui-content:not([class*="ui-body-"])' )
26+
.addClass( 'ui-body-c' )
2727
.end()
2828
.find( ".ui-content,:jqmData(role='footer')" )
2929
.last()
30-
.addClass('ui-corner-bottom ui-overlay-shadow');
30+
.addClass( "ui-corner-bottom ui-overlay-shadow" );
3131

3232
/* bind events
3333
- clicks and submits should use the closing transition that the dialog opened with
3434
unless a data-transition is specified on the link/form
3535
- if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
3636
*/
37-
this.element
38-
.bind( "vclick submit", function(e){
39-
var $targetel;
37+
this.element
38+
.bind( "vclick submit", function( e ) {
39+
var $target;
4040
if( e.type == "vclick" ){
41-
$targetel = $(e.target).closest("a");
41+
$target = $( e.target ).closest( "a" );
4242
}
4343
else{
44-
$targetel = $(e.target).closest("form");
44+
$target = $( e.target ).closest( "form" );
4545
}
4646

47-
if( $targetel.length && !$targetel.jqmData("transition") ){
48-
$targetel
49-
.attr("data-" + $.mobile.ns + "transition", $.mobile.urlHistory.getActive().transition )
50-
.attr("data-" + $.mobile.ns + "direction", "reverse");
47+
if( $target.length && !$target.jqmData( "transition" ) ){
48+
$target
49+
.attr( "data-" + $.mobile.ns + "transition", $.mobile.urlHistory.getActive().transition )
50+
.attr( "data-" + $.mobile.ns + "direction", "reverse" );
5151
}
5252
});
53-
5453
},
5554

5655
//close method goes back in history
57-
close: function(){
56+
close: function() {
5857
window.history.back();
5958
}
6059
});

0 commit comments

Comments
 (0)