aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.dialog.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r--ui/jquery.ui.dialog.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index b2b8be8c0..939571a68 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -39,6 +39,7 @@ var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ui-fr
$.widget("ui.dialog", {
version: "@VERSION",
options: {
+ appendTo: "body",
autoOpen: true,
buttons: {},
closeOnEscape: true,
@@ -124,6 +125,14 @@ $.widget("ui.dialog", {
}
},
+ _appendTo: function() {
+ var element = this.options.appendTo;
+ if ( element && (element.jquery || element.nodeType) ) {
+ return $( element );
+ }
+ return this.document.find( element || "body" ).eq( 0 );
+ },
+
_destroy: function() {
var next,
oldPosition = this.oldPosition;
@@ -276,7 +285,7 @@ $.widget("ui.dialog", {
tabIndex: -1,
role: "dialog"
})
- .appendTo( this.document[ 0 ].body );
+ .appendTo( this._appendTo() );
this._on( this.uiDialog, {
keydown: function( event ) {
@@ -569,6 +578,10 @@ $.widget("ui.dialog", {
this._super( key, value );
+ if ( key === "appendTo" ) {
+ this.uiDialog.appendTo( this._appendTo() );
+ }
+
if ( key === "buttons" ) {
this._createButtons();
}