W3C home > Mailing lists > Public > www-style@w3.org > December 2014

Re: [css-logical-props] do shorthands have logical component longhands?

From: Cameron McCormack <cam@mcc.id.au>
Date: Sun, 21 Dec 2014 10:22:09 +1100
Message-ID: <549604A1.4050802@mcc.id.au>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
Tab Atkins Jr. wrote:
> The current proposal in the spec is that you can insert the keyword
> "logical" into the value, and then the shorthand is for the logical
> properties instead, like "blockquote { margin: logical 1em 1em 1em 0;
> }".
>
> There's an issue in the spec about whether the physical/logical
> versions of the shorthands also reset the logical/physical properties.
>
> fantasai says they definitely should be reset by the shorthand.

Thanks.  So that means they should be set to 0, I assume.

Two followup questions then.

(1) With this rule:

   div { margin-top: 1px; margin-right: 2px;
         margin-bottom: 3px; margin-left: 4px; }

if we get margin, should we serialise as the empty string since 
margin-{inline,block}-{start,end} are not present on the declaration 
(they would be set with '0' values if we assigned the '1px 2px 3px 4px' 
back to the margin property)?

I have a slight worry that someone might be relying on setting the four 
longhands and getting the shorthand back.  But this issue arises any 
time we add new longhand components to a shorthand.

(2) Here is a case where assigning to a shorthand gives you (what I 
think might be) unintuitive results:

   div { margin: 1px;
         margin-inline-start: 0px; margin-inline-end: 0px;
         margin-block-start: 0px; margin-block-end: 0px; }

   decl.style.margin = "2px";

Since the declaration has all of the component longhands already, we 
just overwrite each one with either 2px (for the physical ones) or 0px 
(for the logical ones).  The result is that you'll still have 0px 
margins, as the logical properties still appear after the physical ones.

Should we make assigning to 'margin' move the physical properties to the 
end of the declaration?  (And if we do so, we'll need to ensure that the 
empty string is returned when getting 'margin' if logical properties 
appear after physical ones.)
Received on Saturday, 20 December 2014 23:22:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:49 UTC