aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.position.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-08-27 13:34:14 -0400
committerScott González <scott.gonzalez@gmail.com>2010-08-27 13:34:14 -0400
commit52a052be79d21aa519ccb513dc00a7c54868ef03 (patch)
treec583499b61a193602256bd160d7e4fb1ffacb2bf /ui/jquery.ui.position.js
parent2acfde9e5e411ece98bf7877212f0100d1c8c489 (diff)
downloadjquery-ui-52a052be79d21aa519ccb513dc00a7c54868ef03.tar.gz
jquery-ui-52a052be79d21aa519ccb513dc00a7c54868ef03.zip
Position: Handle $(document) and $(window) for the of option. Fixes #5963 - Position: option 'of' accepts jQuery object unless it wraps document. Fixes #5655 - (Possible) Typo in jquery.ui.position 1.8.1.
Diffstat (limited to 'ui/jquery.ui.position.js')
-rw-r--r--ui/jquery.ui.position.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index dbe28ffa5..a14c5c612 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -26,21 +26,22 @@ $.fn.position = function( options ) {
options = $.extend( {}, options );
var target = $( options.of ),
+ targetElem = target[0],
collision = ( options.collision || "flip" ).split( " " ),
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
targetWidth,
targetHeight,
basePosition;
- if ( options.of.nodeType === 9 ) {
+ if ( targetElem.nodeType === 9 ) {
targetWidth = target.width();
targetHeight = target.height();
basePosition = { top: 0, left: 0 };
- } else if ( options.of.scrollTo && options.of.document ) {
+ } else if ( targetElem.scrollTo && targetElem.document ) {
targetWidth = target.width();
targetHeight = target.height();
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
- } else if ( options.of.preventDefault ) {
+ } else if ( targetElem.preventDefault ) {
// force left top to allow flipping
options.at = "left top";
targetWidth = targetHeight = 0;