#188 bug
John-David Dalton

Element#cumulativeOffset and positionedOffset need to check for offsetTop and offsetLeft bugs

Reported by John-David Dalton | June 25th, 2008 @ 02:23 AM | in 1.6.1

Garrett Smith has pointed out various bugs with offsetTop and 
offsetLeft and we need to create a patch for their use in 
Element#cumulativeOffset and Element#positionedOffset.

Method cumulativeOffsets doesn't account for the many problems:

  • Doesn't account for body.offsetTop ignoring BODY's margin.
  • Doesn't account for BODY being a magic offsetParent.
  • Doesn't add parentNode borderWidth / clientLeft/Top.
  • Doesn't consider Moz bug with border on BODY. [bug report]
A simple example can demonstrate a few of these:

<!DOCTYPE html>
<html>
<head><title>offsetTop border parent</title>
<script src="../library/prototype-1.6.0.2.js"></script>
</head>

<body style="border: 10px solid;margin:10px;">
<div style='border: 1px solid red;position:relative' id='a'>a</div>

</body>
</html>

Now Try:

javascript:alert(Element.Methods.cumulativeOffset(document.getElementById('a')))

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

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

People watching this ticket

Attachments