.position on table rows inside a relative div container gives different results based on scroll position #1708
Comments
|
@mikesherov Can I get your review on this? |
|
Changing this sounds like a breaking change so we might need to do it in 3.0.0 or wait for 4.0.0. I've added the "Needs review" label so that we don't forget about this doubt of mine. |
Why? |
|
Hmm, OK, maybe not. I mean, this will surely break some code but it may be considered a bug fix due to the description in the API. I'd wait for fixes for edge cases that may break some code at least to a minor release, though. I'll set the milestone to 3.1.0 for now so that we don't forget; we can reschedule later. |
|
It's not clear exactly what is going on with this, whether the original report was even a bug or not. We could definitely use some better unit tests from somebody who knew what the right answers were. |
|
Per @mgol's comment, I think making this change in 4.0 is the safest option. |
Originally reported by ripdog: http://bugs.jquery.com/ticket/15239
The docs for .position() clearly state that they return the "current position of an element relative to the offset parent." - explicitly not the position based on the viewport. However, .position does report different results based on where it is moved on the page due to scrolling.
Here's a fiddle: http://jsfiddle.net/6g5upsvq/ Click the button, then scroll and click it again. The .offsetTop direct from the DOM stays constant, but .position changes.
The text was updated successfully, but these errors were encountered: