#12536 closed bug (fixed)
Make .offset() calc less wrong on browsers w/o getBoundingClientRect
Reported by: | 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 ...
Change History (4)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
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.
comment:3 Changed 10 years ago by
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.