Skip to content

Commit 9fd0e86

Browse files
committed
Dialog: Update code style, adding whitespace around string arguments and array indices
1 parent 3945a8f commit 9fd0e86

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

ui/jquery.ui.dialog.js

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,25 @@ $.widget( "ui.dialog", {
8686

8787
_create: function() {
8888
this.originalCss = {
89-
display: this.element[0].style.display,
90-
width: this.element[0].style.width,
91-
minHeight: this.element[0].style.minHeight,
92-
maxHeight: this.element[0].style.maxHeight,
93-
height: this.element[0].style.height
89+
display: this.element[ 0 ].style.display,
90+
width: this.element[ 0 ].style.width,
91+
minHeight: this.element[ 0 ].style.minHeight,
92+
maxHeight: this.element[ 0 ].style.maxHeight,
93+
height: this.element[ 0 ].style.height
9494
};
9595
this.originalPosition = {
9696
parent: this.element.parent(),
9797
index: this.element.parent().children().index( this.element )
9898
};
99-
this.originalTitle = this.element.attr("title");
99+
this.originalTitle = this.element.attr( "title" );
100100
this.options.title = this.options.title || this.originalTitle;
101101

102102
this._createWrapper();
103103

104104
this.element
105105
.show()
106-
.removeAttr("title")
107-
.addClass("ui-dialog-content ui-widget-content")
106+
.removeAttr( "title" )
107+
.addClass( "ui-dialog-content ui-widget-content" )
108108
.appendTo( this.uiDialog );
109109

110110
this._createTitlebar();
@@ -144,7 +144,7 @@ $.widget( "ui.dialog", {
144144

145145
this.element
146146
.removeUniqueId()
147-
.removeClass("ui-dialog-content ui-widget-content")
147+
.removeClass( "ui-dialog-content ui-widget-content" )
148148
.css( this.originalCss )
149149
// Without detaching first, the following becomes really slow
150150
.detach();
@@ -157,7 +157,7 @@ $.widget( "ui.dialog", {
157157

158158
next = originalPosition.parent.children().eq( originalPosition.index );
159159
// Don't try to place the dialog next to itself (#8613)
160-
if ( next.length && next[0] !== this.element[0] ) {
160+
if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
161161
next.before( this.element );
162162
} else {
163163
originalPosition.parent.append( this.element );
@@ -183,7 +183,7 @@ $.widget( "ui.dialog", {
183183
this._focusedElement = null;
184184
this._destroyOverlay();
185185

186-
if ( !this.opener.filter(":focusable").focus().length ) {
186+
if ( !this.opener.filter( ":focusable" ).focus().length ) {
187187

188188
// support: IE9
189189
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
@@ -243,18 +243,18 @@ $.widget( "ui.dialog", {
243243
}
244244

245245
this._isOpen = true;
246-
this.opener = $( this.document[0].activeElement );
246+
this.opener = $( this.document[ 0 ].activeElement );
247247

248248
this._size();
249249
this._position();
250250
this._createOverlay();
251251
this._moveToTop( null, true );
252252
this._show( this.uiDialog, this.options.show, function() {
253253
that._focusTabbable();
254-
that._trigger("focus");
254+
that._trigger( "focus" );
255255
});
256256

257-
this._trigger("open");
257+
this._trigger( "open" );
258258
},
259259

260260
_focusTabbable: function() {
@@ -326,9 +326,9 @@ $.widget( "ui.dialog", {
326326
if ( event.keyCode !== $.ui.keyCode.TAB ) {
327327
return;
328328
}
329-
var tabbables = this.uiDialog.find(":tabbable"),
330-
first = tabbables.filter(":first"),
331-
last = tabbables.filter(":last");
329+
var tabbables = this.uiDialog.find( ":tabbable" ),
330+
first = tabbables.filter( ":first" ),
331+
last = tabbables.filter( ":last" );
332332

333333
if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
334334
first.focus( 1 );
@@ -348,25 +348,25 @@ $.widget( "ui.dialog", {
348348
// We assume that any existing aria-describedby attribute means
349349
// that the dialog content is marked up properly
350350
// otherwise we brute force the content as the description
351-
if ( !this.element.find("[aria-describedby]").length ) {
351+
if ( !this.element.find( "[aria-describedby]" ).length ) {
352352
this.uiDialog.attr({
353-
"aria-describedby": this.element.uniqueId().attr("id")
353+
"aria-describedby": this.element.uniqueId().attr( "id" )
354354
});
355355
}
356356
},
357357

358358
_createTitlebar: function() {
359359
var uiDialogTitle;
360360

361-
this.uiDialogTitlebar = $("<div>")
362-
.addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix")
361+
this.uiDialogTitlebar = $( "<div>" )
362+
.addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
363363
.prependTo( this.uiDialog );
364364
this._on( this.uiDialogTitlebar, {
365365
mousedown: function( event ) {
366366
// Don't prevent click on close button (#8838)
367367
// Focusing a dialog that is partially scrolled out of view
368368
// causes the browser to scroll it into view, preventing the click event
369-
if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) {
369+
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
370370
// Dialog isn't getting focus when dragging (#8063)
371371
this.uiDialog.focus();
372372
}
@@ -384,7 +384,7 @@ $.widget( "ui.dialog", {
384384
},
385385
text: false
386386
})
387-
.addClass("ui-dialog-titlebar-close")
387+
.addClass( "ui-dialog-titlebar-close" )
388388
.appendTo( this.uiDialogTitlebar );
389389
this._on( this.uiDialogTitlebarClose, {
390390
click: function( event ) {
@@ -393,30 +393,30 @@ $.widget( "ui.dialog", {
393393
}
394394
});
395395

396-
uiDialogTitle = $("<span>")
396+
uiDialogTitle = $( "<span>" )
397397
.uniqueId()
398-
.addClass("ui-dialog-title")
398+
.addClass( "ui-dialog-title" )
399399
.prependTo( this.uiDialogTitlebar );
400400
this._title( uiDialogTitle );
401401

402402
this.uiDialog.attr({
403-
"aria-labelledby": uiDialogTitle.attr("id")
403+
"aria-labelledby": uiDialogTitle.attr( "id" )
404404
});
405405
},
406406

407407
_title: function( title ) {
408408
if ( !this.options.title ) {
409-
title.html("&#160;");
409+
title.html( "&#160;" );
410410
}
411411
title.text( this.options.title );
412412
},
413413

414414
_createButtonPane: function() {
415-
this.uiDialogButtonPane = $("<div>")
416-
.addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
415+
this.uiDialogButtonPane = $( "<div>" )
416+
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
417417

418-
this.uiButtonSet = $("<div>")
419-
.addClass("ui-dialog-buttonset")
418+
this.uiButtonSet = $( "<div>" )
419+
.addClass( "ui-dialog-buttonset" )
420420
.appendTo( this.uiDialogButtonPane );
421421

422422
this._createButtons();
@@ -431,7 +431,7 @@ $.widget( "ui.dialog", {
431431
this.uiButtonSet.empty();
432432

433433
if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
434-
this.uiDialog.removeClass("ui-dialog-buttons");
434+
this.uiDialog.removeClass( "ui-dialog-buttons" );
435435
return;
436436
}
437437

@@ -445,7 +445,7 @@ $.widget( "ui.dialog", {
445445
// Change the context for the click callback to be the main element
446446
click = props.click;
447447
props.click = function() {
448-
click.apply( that.element[0], arguments );
448+
click.apply( that.element[ 0 ], arguments );
449449
};
450450
buttonOptions = {
451451
icons: props.icons,
@@ -457,7 +457,7 @@ $.widget( "ui.dialog", {
457457
.button( buttonOptions )
458458
.appendTo( that.uiButtonSet );
459459
});
460-
this.uiDialog.addClass("ui-dialog-buttons");
460+
this.uiDialog.addClass( "ui-dialog-buttons" );
461461
this.uiDialogButtonPane.appendTo( this.uiDialog );
462462
},
463463

@@ -477,7 +477,7 @@ $.widget( "ui.dialog", {
477477
handle: ".ui-dialog-titlebar",
478478
containment: "document",
479479
start: function( event, ui ) {
480-
$( this ).addClass("ui-dialog-dragging");
480+
$( this ).addClass( "ui-dialog-dragging" );
481481
that._blockFrames();
482482
that._trigger( "dragStart", event, filteredUi( ui ) );
483483
},
@@ -494,7 +494,7 @@ $.widget( "ui.dialog", {
494494
"top" + (top >= 0 ? "+" : "") + top,
495495
of: that.window
496496
};
497-
$( this ).removeClass("ui-dialog-dragging");
497+
$( this ).removeClass( "ui-dialog-dragging" );
498498
that._unblockFrames();
499499
that._trigger( "dragStop", event, filteredUi( ui ) );
500500
}
@@ -531,7 +531,7 @@ $.widget( "ui.dialog", {
531531
minHeight: this._minHeight(),
532532
handles: resizeHandles,
533533
start: function( event, ui ) {
534-
$( this ).addClass("ui-dialog-resizing");
534+
$( this ).addClass( "ui-dialog-resizing" );
535535
that._blockFrames();
536536
that._trigger( "resizeStart", event, filteredUi( ui ) );
537537
},
@@ -551,7 +551,7 @@ $.widget( "ui.dialog", {
551551
"top" + (top >= 0 ? "+" : "") + top,
552552
of: that.window
553553
};
554-
$( this ).removeClass("ui-dialog-resizing");
554+
$( this ).removeClass( "ui-dialog-resizing" );
555555
that._unblockFrames();
556556
that._trigger( "resizeStop", event, filteredUi( ui ) );
557557
}
@@ -577,7 +577,7 @@ $.widget( "ui.dialog", {
577577

578578
_position: function() {
579579
// Need to show the dialog to get the actual offset in the position plugin
580-
var isVisible = this.uiDialog.is(":visible");
580+
var isVisible = this.uiDialog.is( ":visible" );
581581
if ( !isVisible ) {
582582
this.uiDialog.show();
583583
}
@@ -607,7 +607,7 @@ $.widget( "ui.dialog", {
607607
this._size();
608608
this._position();
609609
}
610-
if ( this.uiDialog.is(":data(ui-resizable)") ) {
610+
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
611611
this.uiDialog.resizable( "option", resizableOptions );
612612
}
613613
},
@@ -644,9 +644,9 @@ $.widget( "ui.dialog", {
644644
}
645645

646646
if ( key === "draggable" ) {
647-
isDraggable = uiDialog.is(":data(ui-draggable)");
647+
isDraggable = uiDialog.is( ":data(ui-draggable)" );
648648
if ( isDraggable && !value ) {
649-
uiDialog.draggable("destroy");
649+
uiDialog.draggable( "destroy" );
650650
}
651651

652652
if ( !isDraggable && value ) {
@@ -660,9 +660,9 @@ $.widget( "ui.dialog", {
660660

661661
if ( key === "resizable" ) {
662662
// currently resizable, becoming non-resizable
663-
isResizable = uiDialog.is(":data(ui-resizable)");
663+
isResizable = uiDialog.is( ":data(ui-resizable)" );
664664
if ( isResizable && !value ) {
665-
uiDialog.resizable("destroy");
665+
uiDialog.resizable( "destroy" );
666666
}
667667

668668
// currently resizable, changing handles
@@ -677,7 +677,7 @@ $.widget( "ui.dialog", {
677677
}
678678

679679
if ( key === "title" ) {
680-
this._title( this.uiDialogTitlebar.find(".ui-dialog-title") );
680+
this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
681681
}
682682
},
683683

@@ -721,7 +721,7 @@ $.widget( "ui.dialog", {
721721
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
722722
}
723723

724-
if (this.uiDialog.is(":data(ui-resizable)") ) {
724+
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
725725
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
726726
}
727727
},
@@ -749,13 +749,13 @@ $.widget( "ui.dialog", {
749749
},
750750

751751
_allowInteraction: function( event ) {
752-
if ( $( event.target ).closest(".ui-dialog").length ) {
752+
if ( $( event.target ).closest( ".ui-dialog" ).length ) {
753753
return true;
754754
}
755755

756756
// TODO: Remove hack when datepicker implements
757757
// the .ui-front logic (#8989)
758-
return !!$( event.target ).closest(".ui-datepicker").length;
758+
return !!$( event.target ).closest( ".ui-datepicker" ).length;
759759
},
760760

761761
_createOverlay: function() {
@@ -790,8 +790,8 @@ $.widget( "ui.dialog", {
790790
});
791791
}
792792

793-
this.overlay = $("<div>")
794-
.addClass("ui-widget-overlay ui-front")
793+
this.overlay = $( "<div>" )
794+
.addClass( "ui-widget-overlay ui-front" )
795795
.appendTo( this._appendTo() );
796796
this._on( this.overlay, {
797797
mousedown: "_keepFocus"
@@ -822,4 +822,4 @@ $.widget( "ui.dialog", {
822822
}
823823
});
824824

825-
}( jQuery ) );
825+
}( jQuery ));

0 commit comments

Comments
 (0)