#377 ✓fixed_in_master_branch
Chris Harris

viewportOffset gets confused by adjacent cell's padding in IE

Reported by Chris Harris | October 7th, 2008 @ 02:06 PM | in 1.7

I'm trying to use viewportOffset to find the location of an element that's in a table cell. If an adjacent table cell contains an element with top and bottom padding (and this changes the height of the table row and therefore the position of the original element), viewportOffset returns a value that doesn't include said padding.

I have reproduced this problem in IE6 and 7; I can confirm it doesn't happen in Firefox 3 but I haven't tried any other browsers.

In the attached example, uncomment the "breaker button" to see the problem.

Side note: On our site we're using position.Clone in a number of different ways and it all works fine except this. Interestingly, if we remove the IE wrapper for viewportOffset (which changes the element's position from static to relative for the duration of the function), not only do we see no ill effects, but it also appears to fix this issue. Any idea what that wrapper is for?

Many thanks,

Chris Harris

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins