-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fixed #9533 - Position: positioning within document raises error #1072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 (bug #9533)"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we have a few ticket references here and there, we should avoid them. The test speaks for itself. Can you remove the reference? |
||
|
||
collisionTest({ | ||
within: "#within", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,8 +88,8 @@ $.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.isDoc ? "" : within.element.css( "overflow-x" ), | ||
overflowY = within.isWindow || within.isDoc ? "" : within.element.css( "overflow-y" ), | ||
hasOverflowX = overflowX === "scroll" || | ||
( overflowX === "auto" && within.width < within.element[0].scrollWidth ), | ||
hasOverflowY = overflowY === "scroll" || | ||
|
@@ -101,10 +101,12 @@ $.position = { | |
}, | ||
getWithinInfo: function( element ) { | ||
var withinElement = $( element || window ), | ||
isWindow = $.isWindow( withinElement[0] ); | ||
isWindow = $.isWindow( withinElement[0] ), | ||
isDoc = (!!withinElement[0] && withinElement[0].nodeType === 9); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a reference for this check? |
||
return { | ||
element: withinElement, | ||
isWindow: isWindow, | ||
isDoc: isDoc, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about |
||
offset: withinElement.offset() || { left: 0, top: 0 }, | ||
scrollLeft: withinElement.scrollLeft(), | ||
scrollTop: withinElement.scrollTop(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No space before the colon, same thing for the next two.