Re: [cssom-view] New WD "CSSOM View Module"

On Thu, 28 Feb 2008 03:21:12 +0100, Garrett Smith <dhtmlkitchen@gmail.com>  
wrote:
> On Wed, Feb 27, 2008 at 4:32 PM, Anne van Kesteren <annevk@opera.com>  
> wrote:
>>  100% compliant implementations are always unlikely. Yet it's a goal of
>>  many specifications.
>
> The offsetXXX properties should be simple so that it would hard to
> implement them wrong. They should be clearly defined so that any bug
> would be obvious. A test suite - automated - would provide a
> comprehensive view.

Yeah, you're probably right.


> I do not know how to contribute a test, but thought that a test suite
> would help.

It certainly does. The CSS WG has a public mailing list for donating  
tests, public-css-testsuite@w3.org, but that doesn't work well if you want  
to evolve something over time. Therefore a small "open source" project  
somewhere would probably work. I'd be happy to contribute.


> AFACT - IE 6+ has been consistent with standards mode of offsetXXX
> properties. Opera is implementing offsetTop as the spec specifies. I
> don't know which came first - opera's behaviour, or the spec.

Actually, Opera had some serious issues with sites because of its initial  
implementation of offsetParent, etc. Reverse engineering these attributes  
and documenting them has helped us getting an implementation that is more  
compatible with what websites expect. I'm not claiming it's perfect though.

The border box issue for instance with offsetTop / offsetLeft should  
certainly be fixed and I filed a bug on that. I also fixed it in the  
specification:

   http://dev.w3.org/csswg/cssom-view/#offset-attributes


> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
>         "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html>
> <head><title></title>
> </head>
> <body>
> <div id='a'>
> <div id='b' style="position: relative;">bla</div>
> </div>
> </body>
>
> -- What is b's offsetParent? Is it #a, BODY, or HTML?

It's BODY.


> What is b's containing block?

The initial containing block as far as I can tell.


> But why can body not have an offsetParent? It is inconsistent,
> unexpected, and confusing (at least to me) to give BODY special
> treatment.

I agree it's not that nice, but the HTML body element has special  
treatment in other places too: event handling and CSS. So in that respect  
it's not that bad I think.


> Look, for example, at any library - take jQuery.js -
> http://jquery.com/ - and find the offset() function. The function
> assumes conditions based on the userAgent string. jQuery is not the
> only js library that uses browser detection to do these things.

I couldn't find that function, but yes, that might be problematic.


> If the browsers really do implement a spec'd offsetXXX, then the spec
> should be consistent with what IE does.

As I said before, given that IE depends on hasLayout etc. and requires  
different code paths in quirks and standards mode I'm not convinced that's  
the best solution. I also don't think that the various offset attributes  
will see much use going forward once everyone has adopted  
getBoudingClientRect() and getClientRects() methods.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Thursday, 28 February 2008 10:29:22 UTC