diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-09-30 02:48:09 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-09-30 02:48:09 +0000 |
commit | fd976793a98cce2622393ce73c8e8b6a6653b7c2 (patch) | |
tree | 75075f0d0a3157a82117278cddab52e6c07d3118 /ui/jquery.ui.dialog.js | |
parent | 751d7c521b2f6daead7c47d8e79dc2ac472f522f (diff) | |
download | jquery-ui-fd976793a98cce2622393ce73c8e8b6a6653b7c2.tar.gz jquery-ui-fd976793a98cce2622393ce73c8e8b6a6653b7c2.zip |
Dialog: Fixed position parsing.
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r-- | ui/jquery.ui.dialog.js | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 865369798..cd5488313 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -379,39 +379,39 @@ $.widget("ui.dialog", { var myAt = [], offset = [0, 0]; + position = position || $.ui.dialog.defaults.position; + // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( // if (typeof position == 'string' || $.isArray(position)) { // myAt = $.isArray(position) ? position : position.split(' '); - if (position && (typeof positon == "string" || typeof position == "object")) { - if (typeof position == 'string' || '0' in position) { - myAt = position.split ? position.split(' ') : [position[0], position[1]]; - if (myAt.length == 1) { - myAt[1] = myAt[0]; - } - - $.each(['left', 'top'], function(i, offsetPosition) { - if (+myAt[i] == myAt[i]) { - offset[i] = myAt[i]; - myAt[i] = offsetPosition; - } - }); - } else { - if ('left' in position) { - myAt[0] = 'left'; - offset[0] = position.left; - } else if ('right' in position) { - myAt[0] = 'right'; - offset[0] = -position.right; - } - - if ('top' in position) { - myAt[1] = 'top'; - offset[1] = position.top; - } else if ('bottom' in position) { - myAt[1] = 'bottom'; - offset[1] = -position.bottom; + if (typeof position == 'string' || (typeof position == 'object' && '0' in position)) { + myAt = position.split ? position.split(' ') : [position[0], position[1]]; + if (myAt.length == 1) { + myAt[1] = myAt[0]; + } + + $.each(['left', 'top'], function(i, offsetPosition) { + if (+myAt[i] == myAt[i]) { + offset[i] = myAt[i]; + myAt[i] = offsetPosition; } + }); + } else if (typeof position == 'object') { + if ('left' in position) { + myAt[0] = 'left'; + offset[0] = position.left; + } else if ('right' in position) { + myAt[0] = 'right'; + offset[0] = -position.right; + } + + if ('top' in position) { + myAt[1] = 'top'; + offset[1] = position.top; + } else if ('bottom' in position) { + myAt[1] = 'bottom'; + offset[1] = -position.bottom; } } |