Permalink
Browse files

Position: Avoid reading overflow css on documents

Fixes #9533
Closes gh-1072
  • Loading branch information...
meyertee authored and scottgonzalez committed Sep 4, 2013
1 parent 8f267ee commit 1bbbcc723c489d7ef7d72bb62564b8f07805c41c
Showing with 15 additions and 4 deletions.
  1. +8 −1 tests/unit/position/position_core.js
  2. +7 −3 ui/jquery.ui.position.js
@@ -575,7 +575,14 @@ test( "collision: flip, with margin", function() {
});
test( "within", function() {
expect( 6 );
expect( 7 );
collisionTest({
within: document
}, {
top: 10,
left: 10
}, "within document" );
collisionTest({
within: "#within",
View
@@ -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(),

0 comments on commit 1bbbcc7

Please sign in to comment.