diff options
author | Thomas Meyer <meyertee@gmail.com> | 2013-09-05 00:13:53 +0200 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2014-01-15 05:17:50 -0500 |
commit | 1bbbcc723c489d7ef7d72bb62564b8f07805c41c (patch) | |
tree | 9fdff36e431c7cc42fea643c4203215350c37f7f /ui/jquery.ui.position.js | |
parent | 8f267ee3310bee8d7a2cb9e46b023a79ed84bfc1 (diff) | |
download | jquery-ui-1bbbcc723c489d7ef7d72bb62564b8f07805c41c.tar.gz jquery-ui-1bbbcc723c489d7ef7d72bb62564b8f07805c41c.zip |
Position: Avoid reading overflow css on documents
Fixes #9533
Closes gh-1072
Diffstat (limited to 'ui/jquery.ui.position.js')
-rw-r--r-- | ui/jquery.ui.position.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index f088fa0be..f304c1908 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -89,8 +89,10 @@ $.position = { return (cachedScrollbarWidth = w1 - w2); }, getScrollInfo: function( within ) { - var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), - overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), + var overflowX = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-x" ), + overflowY = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-y" ), hasOverflowX = overflowX === "scroll" || ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), hasOverflowY = overflowY === "scroll" || @@ -102,10 +104,12 @@ $.position = { }, getWithinInfo: function( element ) { var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ); + isWindow = $.isWindow( withinElement[0] ), + isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; return { element: withinElement, isWindow: isWindow, + isDocument: isDocument, offset: withinElement.offset() || { left: 0, top: 0 }, scrollLeft: withinElement.scrollLeft(), scrollTop: withinElement.scrollTop(), |