W3C home > Mailing lists > Public > www-style@w3.org > April 2008

Re: [cssom-view] Why is body's offsetParent null ?

From: Anne van Kesteren <annevk@opera.com>
Date: Wed, 23 Apr 2008 11:55:22 +0200
To: "Daniel Glazman" <daniel.glazman@disruptive-innovations.com>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.t915sxgu64w2qv@annevk-t60.oslo.opera.com>

On Wed, 23 Apr 2008 11:40:00 +0200, Daniel Glazman  
<daniel.glazman@disruptive-innovations.com> wrote:
> Anne van Kesteren wrote:
>
>> No, the way it works is that if offsetParent is equal to the HTML body  
>> element you give the dinstance relative to the initial containing block  
>> origin rather than the HTML body element. This is how non-IE browsers  
>> already function. (That's step 2 in the offsetTop algorithm.)
>
> I understood how you want it to work in CSS OM View. I'm just saying
> this is not how people are currently using it.
> http://www.quirksmode.org/js/findpos.html

Per the specification this script works exactly as the author intended it  
to work. I'm not sure why you think it doesn't. (That script would not  
work for the HTML body element if that's what you mean, but that's already  
the case in implementations today and therefore I wouldn't expect people  
to rely on that. And if they want that location they're welcome to use  
getBoundingClientRect() instead.)


> That said, I have a comment to make on section 8.1. You wrote:
>
> "The computed value of the position property of A is static and the
> ancestor is one of the following HTML elements: td, th, or table."
>
> That means you never return tr or tbody, and that is a problem when
> you deal with multiple tbody inside a single table, or a cell inside
> a footer or header. I would like to know why there is this restriction.
> BTW, we all know that MSIE deeply sucks when querying offset* values on
> a TD or TH, replying zero, so compatibility with existing IE practice is
> unlikely here.

This seemed to be most compatible with existing implementations.


Could you elaborate on why it is problem? I suppose that if we have enough  
use cases we could look into creating a more sophisticated API for the box  
model for the next level of the specification.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Wednesday, 23 April 2008 09:58:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:05 GMT