Re: [css3-regions] offsetParent for element collected inside a named flow

On 3/25/13, Andrei Bucur <abucur@adobe.com> wrote:
> With regions, this is more complicated because an element gets to occupy a
> certain space inside the viewport because of both the flow layout and region
> layout. I can imagine there are situations when developers want to access
> the offsetParent relative to the flow in some contexts and the visual
> offsetParent relative to the regions in other contexts.
>
Nobody who knows what they are doing would want to use offsetParent.
The problems with this festering property have continued because it
was specified normatively. All the reasons why that should not have
happened are a matter of public record, but googling for 10s:

| CSSOM Views has been implemented in various ways as it evolves. The
| spec has changed Safari and IE8 (IE8 broke the more sensible approach
| of IE7).

| Differences in offset* can be seen in IE6, 7, 8, FF3, Opera 9.2, 9.5,
| Safari2, Safari 3. (8 fairly modern browsers). The offset* does not
| work reliably across browsers or versions. It is unreasonable to
| standardize something that is so varied.
|
| Suggestion: Create a new property that can be clearly defined, and
| fulfills developers' needs.
|
| There may be considerations for whether that TD can be considered a
| containing block in a more pure CSS sense.


> If we go with the approach of changing this to follow only the visual
> ancestor path there will be no easy way to compute the flow offset*
> properties. I don't have hard data but I think there are JS libraries that
> use the offset* properties to make raadjustment to the position of elements
> after layout. If we take the elements using those hypothetical libraries and
> flow them inside regions their layout will break because they expect
> offsetParent to point inside the flow, not the regions.
>
> Maybe we can create a new API on the CSSOM (like visualOffset*) that can
> behave the way you described for regions, overflow fragments etc. and follow
> the visual ancestor path.
>
> Thoughts?
>
Call getBoundingClientRect on 2 elements and do subtraction.
-- 
Garrett
Twitter: @xkit
personx.tumblr.com

Received on Monday, 25 March 2013 16:42:58 UTC