diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2009-09-19 14:03:53 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2009-09-19 14:03:53 +0000 |
commit | 122a6cdd5fbc1b3e1769bb4669dc68e7d8279177 (patch) | |
tree | 2aee02df4825533a300ed0c837a6b4cd015a8b0a /ui/jquery.ui.dialog.js | |
parent | c59c0421ba482dc9c2a0a47888564ec98659ccda (diff) | |
download | jquery-ui-122a6cdd5fbc1b3e1769bb4669dc68e7d8279177.tar.gz jquery-ui-122a6cdd5fbc1b3e1769bb4669dc68e7d8279177.zip |
dialog: fixed _position regression; wrote a test for the default positon, which still needs some tuning
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r-- | ui/jquery.ui.dialog.js | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index ddeeda7c6..702b30a92 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -382,35 +382,36 @@ $.widget("ui.dialog", { // 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 positon != "object")) - return - 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; + if (position && (typeof positon == "string" || typeof positon == "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; } - }); - } 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; } } |