Skip to content

Commit 9d419fa

Browse files
committed
Dialog: Add support for setOption with classes
1 parent 68c4166 commit 9d419fa

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

ui/dialog.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131

3232
$.widget( "ui.dialog", {
3333
version: "@VERSION",
34+
_elementsFromClassKey: function( classKey ) {
35+
switch( classKey ) {
36+
case "ui-dialog":
37+
return this.widget();
38+
case "ui-dialog-content":
39+
return this.element;
40+
case "ui-dialog-titlebar":
41+
return this.uiDialogTitlebar;
42+
case "ui-dialog-titlebar-close":
43+
if ( this.uiDialogTitlebar.hasClass( classKey ) ) {
44+
return this.uiDialogTitlebar;
45+
}
46+
default:
47+
return this._superApply( arguments );
48+
}
49+
},
3450
options: {
3551
appendTo: "body",
3652
autoOpen: true,
@@ -395,8 +411,6 @@ $.widget( "ui.dialog", {
395411
},
396412

397413
_createTitlebar: function() {
398-
var uiDialogTitle;
399-
400414
this.uiDialogTitlebar = $( "<div>" )
401415
.addClass( this._classes( "ui-dialog-titlebar") + " ui-widget-header ui-helper-clearfix" )
402416
.prependTo( this.uiDialog );
@@ -432,14 +446,14 @@ $.widget( "ui.dialog", {
432446
}
433447
});
434448

435-
uiDialogTitle = $( "<span>" )
449+
this.uiDialogTitle = $( "<span>" )
436450
.uniqueId()
437451
.addClass( this._classes( "ui-dialog-title" ) )
438452
.prependTo( this.uiDialogTitlebar );
439-
this._title( uiDialogTitle );
453+
this._title( this.uiDialogTitle );
440454

441455
this.uiDialog.attr({
442-
"aria-labelledby": uiDialogTitle.attr( "id" )
456+
"aria-labelledby": this.uiDialogTitle.attr( "id" )
443457
});
444458
},
445459

0 commit comments

Comments
 (0)