Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 5 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 5 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 5 years ago by dmethvin

  • Component changed from unfiled to offset
  • Milestone changed from None to 1.8.2
  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Summary changed from Please re-open ticket #12534 to 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 5 years ago by Dave Methvin

  • Resolution set to fixed
  • Status changed from open to 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

comment:4 Changed 5 years ago by dmethvin

#12580 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.