Skip to content

Commit dfaba1d

Browse files
committed
Dialog: Add support for setOption with classes
1 parent 8c0b1ac commit dfaba1d

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

ui/dialog.js

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,6 @@ $.widget( "ui.dialog", {
395395
},
396396

397397
_createTitlebar: function() {
398-
var uiDialogTitle;
399-
400398
this.uiDialogTitlebar = $( "<div>" )
401399
.addClass( this._classes( "ui-dialog-titlebar") + " ui-widget-header ui-helper-clearfix" )
402400
.prependTo( this.uiDialog );
@@ -432,14 +430,14 @@ $.widget( "ui.dialog", {
432430
}
433431
});
434432

435-
uiDialogTitle = $( "<span>" )
433+
this.uiDialogTitle = $( "<span>" )
436434
.uniqueId()
437435
.addClass( this._classes( "ui-dialog-title" ) )
438436
.prependTo( this.uiDialogTitlebar );
439-
this._title( uiDialogTitle );
437+
this._title( this.uiDialogTitle );
440438

441439
this.uiDialog.attr({
442-
"aria-labelledby": uiDialogTitle.attr( "id" )
440+
"aria-labelledby": this.uiDialogTitle.attr( "id" )
443441
});
444442
},
445443

@@ -648,6 +646,39 @@ $.widget( "ui.dialog", {
648646
}
649647
},
650648

649+
_elementsFromClassKey: function( classKey ) {
650+
switch ( classKey ) {
651+
case "ui-dialog":
652+
return this.uiDialog;
653+
case "ui-dialog-resizing":
654+
if ( this.uiDialog.hasClass( classKey ) ) {
655+
return this.uiDialog;
656+
}
657+
return $();
658+
case "ui-dialog-titlebar":
659+
return this.uiDialogTitlebar;
660+
case "ui-dialog-titlebar-close":
661+
if ( this.uiDialogTitlebar.hasClass( classKey ) ) {
662+
return this.uiDialogTitlebar;
663+
}
664+
return $();
665+
case "ui-dialog-title":
666+
return this.uiDialogTitle;
667+
case "ui-dialog-buttons":
668+
case "ui-dialog-dragging":
669+
case "ui-dialog-buttonset":
670+
return this.uiButtonSet;
671+
case "ui-dialog-buttonpane":
672+
return this.uiDialogButtonPane;
673+
case "ui-dialog-overlay":
674+
if ( this.overlay ) {
675+
return this.overlay;
676+
}
677+
return $();
678+
}
679+
return this._superApply( arguments );
680+
},
681+
651682
_setOptions: function( options ) {
652683
var that = this,
653684
resize = false,

0 commit comments

Comments
 (0)