- From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
- Date: Wed, 23 Apr 2008 11:10:34 +0200
- To: "www-style@w3.org" <www-style@w3.org>
Anne van Kesteren wrote:
> Actually, you would probably always use getBoundingClientRect() as
> that's far more consistent and reliable than any of the offset*
> attributes. They are mainly defined because lots of legacy scripts use
> them currently to calculate the position of an element using while loops
> (which the specification handles fine).
So the behavioural difference between body and other elements is
introduced because of MSIE but the Web is full of the following
script:
var t = 0;
var p = myElement;
while (p) {
t += p.offsetTop;
p = p.offsetParent;
}
// use t
Because of the change you introduce saying document.body.offsetTop
is now always zero, such scripts will give an erroneous result for
non-IE browsers. Right ?
</Daniel>
Received on Wednesday, 23 April 2008 09:11:10 UTC