-
Notifications
You must be signed in to change notification settings - Fork 757
Description
I could not find a defintion that states how getComputedStyle() is supposed to work for fragmented elements.
getComputedStyle() returns the resolved value. In some cases, that corresponds to the computed value, and in some cases that corresponds to the used value. Even when an element is fragmented, the computed value is clearly a per-element thing, but the way the used value is calculated from the computed value as part of layout and can, in some cases, differ per fragment. In such cases, I could not find any spec that says what getComputedStyle() is supposed to return.
For many properties, the used value is equal to the computed value anyway, so for them there's no problem, but that's not always true. Most prominently, what about the width and height of fragmented block elements: should the used value of the height property be the height of the first fragment, or the sum of the height of all fragments (or something else)? Should the used value of the width be the that of the first fragment, or the sum, or the average? Should potentially orthogonal writing-modes make a difference? Should a different display type make a difference? More properties may have answers that vary per fragment, maybe due to percentages (see #6512) or to box-decoration-break.
I think the only answer we can consistently apply to all properties and all display types, regardless of writing-mode, box-decoration-break, etc, is to return the used value on the first fragment. We could special-case some situations to get sums or averages or other computations to derive one value from several, but that seems like a lot corner-case handling for no clear use-case.
In terms of current implementations, as far as I can tell Firefox does just return the values of the first fragment in all cases. Chrome and Safari seem to have special cased block-size (and whichever of width and height it maps to) to return a sum of all fragments.
If there's no compat constraint, I'd suggest standardizing on the simpler behavior of only taking into account the first fragment. If we do want to special case some properties, we should document them.