]> source.dussan.org Git - jquery-ui.git/commitdiff
Position: offset() always returns null for window, so provide default 0/0 coordinates...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 20 Apr 2012 12:13:52 +0000 (14:13 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 20 Apr 2012 12:13:52 +0000 (14:13 +0200)
ui/jquery.ui.position.js

index ea176688e9a4d7f178e2c4de94816ca6a5d226e7..5a2ede2b8aa457e4d3be6715095fc6b7ea19ffb4 100644 (file)
@@ -71,7 +71,7 @@ $.position = {
                return {
                        element: withinElement,
                        isWindow: isWindow,
-                       offset: withinElement.offset(),
+                       offset: withinElement.offset() || { left: 0, top: 0 },
                        scrollLeft: withinElement.scrollLeft(),
                        scrollTop: withinElement.scrollTop(),
                        width: isWindow ? withinElement.width() : withinElement.outerWidth(),
@@ -361,7 +361,7 @@ $.ui.position = {
                        }
 
                        var within = data.within,
-                               withinOffset = ( within.isWindow ? 0 : within.offset.left ) + within.scrollLeft,
+                               withinOffset = within.offset.left + within.scrollLeft,
                                outerWidth = within.width,
                                offsetLeft = within.isWindow ? 0 : within.offset.left,
                                collisionPosLeft = position.left - data.collisionPosition.marginLeft,
@@ -399,7 +399,7 @@ $.ui.position = {
                        }
 
                        var within = data.within,
-                               withinOffset = ( within.isWindow ? 0 : within.offset.top ) + within.scrollTop,
+                               withinOffset = within.offset.top + within.scrollTop,
                                outerHeight = within.height,
                                offsetTop = within.isWindow ? 0 : within.offset.top,
                                collisionPosTop = position.top - data.collisionPosition.marginTop,