Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12536 closed bug (fixed)

Make .offset() calc less wrong on browsers w/o getBoundingClientRect

Reported by: gabriel.schulhof@… Owned by:
Priority: blocker Milestone: 1.8.2
Component: offset Version: git
Keywords: Cc:
Blocked by: Blocking:


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 9 years ago by anonymous

I've also noticed that on BB5 elements have properties called clientLeft, clientTop, clientWidth, and clientHeight ... I think these could be used as well.

comment:2 Changed 9 years ago by dmethvin

Component: unfiledoffset
Milestone: None1.8.2
Priority: undecidedblocker
Status: newopen
Summary: Please re-open ticket #12534Make .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 9 years ago by Dave Methvin

Resolution: fixed
Status: openclosed

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

comment:4 Changed 9 years ago by dmethvin

#12580 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.