W3C home > Mailing lists > Public > public-css-archive@w3.org > November 2018

Re: [csswg-drafts] [css-logical] Flow-relative syntax for `margin`-like shorthands (#1282)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Fri, 30 Nov 2018 17:21:07 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-443275428-1543598466-sysbot+gh@w3.org>
The problem is that it's bad if you need to know whether the shorthand will expand into physical OR logical longhands at specified-value time, but this depends on the computed value of `flow-mode` (or `writing-mode` in your second idea, but this would be too hacky).

However, something similar to https://drafts.csswg.org/css-variables-1/#variables-in-shorthands could be done:
 - The shorthand expands into all physical AND logical longhands (the order does not matter)
 - The specified value of the longhands is set to a special, unobservable to authors "pending-logical-resolution value"
 - This value must then be cascaded as normal
 - At computed-value time, the shorthand must be parsed and the longhands must be given their appropriate values at that point according to the computed value of `flow-mode`.
 - Pending-logical-resolution values must be serialized as the empty string, if an API allows them to be observed.

It think this would more or less work, but it would be a breaking change:

element.style.margin = "1px 2px 3px 4px";

Currently it produces `"1px"`, but would become `""` because at specified-value time it's not known whether the `1px` will be set to `margin-top` or `margin-block-start`.

So IMO it would be simpler and less problematic to decide between logical or physical via syntax instead of via the computed value of another property.

GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1282#issuecomment-443275428 using your GitHub account
Received on Friday, 30 November 2018 17:21:09 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:39 UTC