aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2008-09-14 14:47:06 +0000
committerScott González <scott.gonzalez@gmail.com>2008-09-14 14:47:06 +0000
commit8bd855a162784f138ed8764692d472d97c725fcb (patch)
treebf422d0cb8d9a0211822de7d8178d13fde412c3b /ui
parent7e9dcd21defaba1038a0a4901d0b02a6817472d9 (diff)
downloadjquery-ui-8bd855a162784f138ed8764692d472d97c725fcb.tar.gz
jquery-ui-8bd855a162784f138ed8764692d472d97c725fcb.zip
Dialog: Fixed #3220: Non-resizable dialogs shouldn't instantiate resizables.
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.dialog.js74
1 files changed, 45 insertions, 29 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js
index 2670d0ef2..d1438fff9 100644
--- a/ui/ui.dialog.js
+++ b/ui/ui.dialog.js
@@ -34,9 +34,6 @@ $.widget("ui.dialog", {
var self = this,
options = this.options,
- resizeHandles = typeof options.resizable == 'string'
- ? options.resizable
- : 'n,e,s,w,se,sw,ne,nw',
uiDialogContent = this.element
.removeAttr('title')
@@ -134,30 +131,7 @@ $.widget("ui.dialog", {
(options.draggable || uiDialog.draggable('disable'));
}
- if ($.fn.resizable) {
- uiDialog.resizable({
- cancel: '.ui-dialog-content',
- helper: options.resizeHelper,
- maxWidth: options.maxWidth,
- maxHeight: options.maxHeight,
- minWidth: options.minWidth,
- minHeight: options.minHeight,
- start: function() {
- (options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
- },
- resize: function() {
- (options.autoResize && self._size.apply(self));
- (options.resize && options.resize.apply(self.element[0], arguments));
- },
- handles: resizeHandles,
- stop: function() {
- (options.autoResize && self._size.apply(self));
- (options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
- $.ui.dialog.overlay.resize();
- }
- });
- (options.resizable || uiDialog.resizable('disable'));
- }
+ (options.resizable && $.fn.resizable && this._makeResizable());
this._createButtons(options.buttons);
this._isOpen = false;
@@ -166,6 +140,37 @@ $.widget("ui.dialog", {
(options.autoOpen && this.open());
},
+ _makeResizable: function(handles) {
+ handles = (handles === undefined ? this.options.resizable : handles);
+ var self = this,
+ options = this.options,
+ resizeHandles = typeof handles == 'string'
+ ? handles
+ : 'n,e,s,w,se,sw,ne,nw';
+
+ this.uiDialog.resizable({
+ cancel: '.ui-dialog-content',
+ helper: options.resizeHelper,
+ maxWidth: options.maxWidth,
+ maxHeight: options.maxHeight,
+ minWidth: options.minWidth,
+ minHeight: options.minHeight,
+ start: function() {
+ (options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
+ },
+ resize: function() {
+ (options.autoResize && self._size.apply(self));
+ (options.resize && options.resize.apply(self.element[0], arguments));
+ },
+ handles: resizeHandles,
+ stop: function() {
+ (options.autoResize && self._size.apply(self));
+ (options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
+ $.ui.dialog.overlay.resize();
+ }
+ });
+ },
+
_setData: function(key, value){
(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
switch (key) {
@@ -182,8 +187,19 @@ $.widget("ui.dialog", {
this._position(value);
break;
case "resizable":
- (typeof value == 'string' && this.uiDialog.data('handles.resizable', value));
- this.uiDialog.resizable(value ? 'enable' : 'disable');
+ var uiDialog = this.uiDialog,
+ isResizable = this.uiDialog.is(':data(resizable)');
+
+ // currently resizable, becoming non-resizable
+ (isResizable && !value && uiDialog.resizable('destroy'));
+
+ // currently resizable, changing handles
+ (isResizable && typeof value == 'string' &&
+ uiDialog.resizable('option', 'handles', value));
+
+ // currently non-resizable, becoming resizable
+ (isResizable || this._makeResizable(value));
+
break;
case "title":
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');