Skip to content

Commit 6a2deea

Browse files
committed
Merge pull request jquery-archive#1724 from eddiemonge/dialogToCodeStandards
Dialog to code standards and refactor a bit
2 parents a5d3c05 + 244cda8 commit 6a2deea

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

js/jquery.mobile.dialog.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ $.widget( "mobile.dialog", $.mobile.widget, {
1010
closeBtnText: "Close"
1111
},
1212
_create: function() {
13-
var self = this,
14-
$el = self.element;
13+
var $el = this.element;
1514

1615
/* class the markup for dialog styling */
17-
this.element
16+
$el
1817
//add ARIA role
1918
.attr( "role", "dialog" )
2019
.addClass( "ui-page ui-dialog ui-body-a" )
@@ -34,17 +33,11 @@ $.widget( "mobile.dialog", $.mobile.widget, {
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
36+
$el
3837
.bind( "vclick submit", function( e ) {
39-
var $target;
40-
if( e.type == "vclick" ){
41-
$target = $( e.target ).closest( "a" );
42-
}
43-
else{
44-
$target = $( e.target ).closest( "form" );
45-
}
38+
var $target = $( e.target ).closest( e.type === "vclick" ? "a" : "form" );
4639

47-
if( $target.length && !$target.jqmData("transition") ){
40+
if( $target.length && ! $target.jqmData( "transition" ) ) {
4841
var active = $.mobile.urlHistory.getActive() || {};
4942
$target
5043
.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )

0 commit comments

Comments
 (0)