[csswg-drafts] [css-position][cssom] Resolved value of over-constrained percentages in inset properties

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-position][cssom] Resolved value of over-constrained percentages in inset properties ==
[CSSOM](https://drafts.csswg.org/cssom/#resolved-values) says for `top`, `right`, `bottom` and `left`:

> If the property applies to a positioned element and the resolved value of the display property is not `none` or contents, and the property is not over-constrained, then the resolved value is the used value. Otherwise the resolved value is the computed value.

Therefore, if I use

```css
element.style.cssText = "position: relative; left: 1%; right: 2%;";
getComputedStyle(element).right;
```

since relative positioning doesn't stretch boxes, there is over-constrainment, so I should get the computed value.

So what's the computed value of a percentage? https://drafts.csswg.org/css-position-3/#box-offsets-trbl says

> For `position: relative`, see Relative positioning.
> [...] Otherwise: [...] if specified as a `<percentage>`, the specified value[...].

[Relative positioning](https://drafts.csswg.org/css-position-3/#rel-pos) doesn't mention percentages, so it seems it should be the specified value according to "otherwise". But that's not the case in Firefox and Blink, which return the absolute length instead.

WebKit returns the used value when there is over-contraintment and I want to implement the proper behavior, which is not clear.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3059 using your GitHub account

Received on Monday, 27 August 2018 12:54:26 UTC