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

On Wed, Feb 27, 2008 at 4:32 PM, Anne van Kesteren <annevk@opera.com> wrote:
> On Thu, 28 Feb 2008 00:16:32 +0100, Garrett Smith <dhtmlkitchen@gmail.com>
>  wrote:

>  > No browser implements the spec as written. The browsers are "locked
>  > in" - 100% compliant change among browsers is unlikely.
>
>  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.

>  > Even if the browsers could change, the spec has a few serious flaws.
>
>  We can fix those.

That's not without complications.

>  I didn't realize you wanted to make it a W3C project. The W3C does have
>  dev.w3.org but that requires account set up and all. I'm not sure how easy
>  that is for non-members. I was just giving you something to work with, as
>  I don't represent the W3C.

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


>  > The spec has resulted in contrasting implementations of offsetXXX.
>
>  You mean we had interoperable implementations before the specification
>  came out to be and after the specification was published implementations
>  started to diverse? Given that the specification started out because of
>  implementation differences that seems a weird statement to make.
>

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.



>  Layout coordinates are calculated with respect to the offsetParent, not
>  the containing block. Although if most browsers indeed implement
>  offsetParent as always being the containing block we should maybe go with
>  that...

No.

An offsetParent is a containing block, but a containing block might
not be an offsetParent.

offsetParent is a relatively positioned containing block. A containing
block for a relatively positioned child could have position: static.

In the case --

<!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?

What is b's containing block?


>  > CSSOM prevents determining the coords of the BODY element.
>
>  Actually, you can determine them using the getBoundingClientRect() method.

That's true, and getBoundingClientRect is the right method for this tast.

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

>  > The browsers have different implementations - from each other and from
>  > the spec. Should all the browsers change? Won't that break existing
>  > scripts? Should the spec change? Would that be fair to any browser?
>
>  They should converge in one way or another.

If the browsers change, it would break existing sites. That's a good
thing, in a way...

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.

When the browsers change, scripts that depend on anomalous behavior
associated with browser x's user-agent break. This is good because it
discourages such practices.

Will browsers do that? Can you imagine how many bug reports there will be?

>  > Or should CSSOM offsetXXX properties should be removed from the spec
>  > and replaced with something new?
>
>  Replacing them with something new doesn't solve the problem of them not
>  being implemented in the same way.

That is true.

A new alternative - one that could be clearly defined -

if(el.displacedParent) { /** well defined standard */
 ...
}

- would avoid breaking existing scripts.

What IE does is more consistent with itself (WRT BODY) and easier to work with.

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

Garrett

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

Received on Thursday, 28 February 2008 02:21:22 UTC