Side navigation
#12536 closed bug (fixed)
Opened September 14, 2012 10:12AM UTC
Closed September 14, 2012 02:19PM UTC
Last modified September 20, 2012 03:08PM UTC
Make .offset() calc less wrong on browsers w/o getBoundingClientRect
Reported by: | gabriel.schulhof@intel.com | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.8.2 |
Component: | offset | Version: | git |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
We had agreed that the fix was not for the whole offset function to return { left: 0, top: 0 }, but to have something like
if ( typeof elem.getBoundingClientRect === "undefined" ) {
box = { left: 0, top: 0 };
} else {
box = elem.getBoundingClientRect();
}
... and then proceed to the calculation below, which will give us an offset that may be incorrect, but it's closer than 0, 0, because it takes into account the scrollLeft and scrollTop.
This is related to ticket #12534 ...
Attachments (0)
Change History (4)
Changed September 14, 2012 10:34AM UTC by comment:1
Changed September 14, 2012 01:01PM UTC by comment:2
component: | unfiled → offset |
---|---|
milestone: | None → 1.8.2 |
priority: | undecided → blocker |
status: | new → open |
summary: | Please re-open ticket #12534 → Make .offset() calc less wrong on browsers w/o getBoundingClientRect |
Sounds reasonable, I didn't get that from the IRC discussion yesterday. Before I make further changes though, let's discuss.
Changed September 14, 2012 02:19PM UTC by comment:3
resolution: | → fixed |
---|---|
status: | open → closed |
Fix #12536. Start at .offset() 0,0 if no getBoundingClientRect.
This lets us still add the other offset components to the number so they're less wrong. Affects BlackBerry 5 and iOS 3, everyone else has gBCR.
Changeset: 560c178c82da95b2f88ae518552463d87fe5adbf
I've also noticed that on BB5 elements have properties called clientLeft, clientTop, clientWidth, and clientHeight ... I think these could be used as well.