Merge pull request #1724 from eddiemonge/dialogToCodeStandards

Dialog to code standards and refactor a bit
This commit is contained in:
Kin Blas 2011-05-31 14:48:05 -07:00
commit 6a2deead0f

View file

@ -10,11 +10,10 @@ $.widget( "mobile.dialog", $.mobile.widget, {
closeBtnText: "Close"
},
_create: function() {
var self = this,
$el = self.element;
var $el = this.element;
/* class the markup for dialog styling */
this.element
$el
//add ARIA role
.attr( "role", "dialog" )
.addClass( "ui-page ui-dialog ui-body-a" )
@ -34,17 +33,11 @@ $.widget( "mobile.dialog", $.mobile.widget, {
unless a data-transition is specified on the link/form
- if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
*/
this.element
$el
.bind( "vclick submit", function( e ) {
var $target;
if( e.type == "vclick" ){
$target = $( e.target ).closest( "a" );
}
else{
$target = $( e.target ).closest( "form" );
}
var $target = $( e.target ).closest( e.type === "vclick" ? "a" : "form" );
if( $target.length && !$target.jqmData("transition") ){
if( $target.length && ! $target.jqmData( "transition" ) ) {
var active = $.mobile.urlHistory.getActive() || {};
$target
.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )