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

All, the volume and quality of the discussion is impressive and very much appreciated. While I understand it may be hard - or foolish - to separate offsetParent's semantics from the rest of the offset* properties, the value of offsetParent for the topmost body element is what I am aiming to define here.

Afaik, it is practically always null today; but in IE8b1's standards mode, it refers to html. From an API design and object model standpoint, the latter is what the caller expects, imo (at least if unversed or unconstrained by the dark arts of browser cross-compat). From an app compat standpoint, we have changed a behavior implemented by Firefox, Opera, Safari and previous versions of IE in both quirks and standards mode.

As mentioned by others earlier, simple list-walking patterns such as the one below from Prototype's dom.js are fairly common :

cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

..and our first IE8 Beta may have pulled this rug by a number of pixels for a number of web sites. Some of us at Microsoft judge this to be a welcome fix to a long-standing bug, while others - and I am among the latter - see it as a regression from a de-facto standard behavior.

To the extent possible, I am looking for informed opinion as well as any data - web sites, frameworks, assumptions explicitly or implicitly stated in related standards - that can give us a better measure of the decision.

More general background and comments :
* We are currently taking a close look at the behavior of the offset properties for IE8 standards mode and our next Beta.
* While minimizing gaps between quirks and standards mode is sound and pragmatic, this gap may be variable across implementations and between releases. In the case of IE, the gap between its quirks mode and everyone else's standards mode may be harder to bridge without causing breaking changes, as IE8b1 has demonstrated.
* But we are certainly looking for ways to fix, improve and align the specification and implementation of these properties. All feedback and suggestions in this area is very welcome.

Sylvain

Received on Wednesday, 23 April 2008 19:58:24 UTC