Re: [css-syntax] Duplicate declarations in style rules

On Tue, 13 Aug 2013 12:51:17 +0200, Simon Sapin <simon.sapin@exyr.org>  
wrote:

> I can only think of two reasonable ways to do this:
>
> * By alphabetical order of longhand property name
> * In the same order as in the Value line in the spec for the shorthand.
>
> What do implementations do?

Not alphabetical at least.

For example the 'border' property,  
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2447 I get  
this order in Blink

log: border-top-width
log: border-right-width
log: border-bottom-width
log: border-left-width
log: border-top-style
log: border-right-style
log: border-bottom-style
log: border-left-style
log: border-top-color
log: border-right-color
log: border-bottom-color
log: border-left-color
log: border-image-source
log: border-image-slice
log: border-image-width
log: border-image-outset
log: border-image-repeat

and this order in Gecko

log: border-top-width
log: border-right-width-value
log: border-right-width-ltr-source
log: border-right-width-rtl-source
log: border-bottom-width
log: border-left-width-value
log: border-left-width-ltr-source
log: border-left-width-rtl-source
log: border-top-style
log: border-right-style-value
log: border-right-style-ltr-source
log: border-right-style-rtl-source
log: border-bottom-style
log: border-left-style-value
log: border-left-style-ltr-source
log: border-left-style-rtl-source
log: border-top-color
log: border-right-color-value
log: border-right-color-ltr-source
log: border-right-color-rtl-source
log: border-bottom-color
log: border-left-color-value
log: border-left-color-ltr-source
log: border-left-color-rtl-source
log: -moz-border-top-colors
log: -moz-border-right-colors
log: -moz-border-bottom-colors
log: -moz-border-left-colors
log: border-image-source
log: border-image-slice
log: border-image-width
log: border-image-outset
log: border-image-repeat

and this order in IE10

log: border-top-color
log: border-right-color
log: border-bottom-color
log: border-left-color
log: border-top-width
log: border-right-width
log: border-bottom-width
log: border-left-width
log: border-top-style
log: border-right-style
log: border-bottom-style
log: border-left-style


http://dev.w3.org/csswg/css-backgrounds/#border says

Value: <line-width> || <line-style> || <color>

But <line-width> doesn't by itself say what the order should be for the  
longhands it sets, but it would be reasonable to use the same order as the  
Value: of border-width.

Also it says "The ‘border’ shorthand also resets ‘border-image’ to its  
initial value." so it doesn't quite work to just say "use the same order  
as Value:" since that doesn't say where border-image should be.

In CSSOM I've said to use the "canonical" order. I guess it would make  
sense for each shorthand definition to say what its canonical order is,  
and have it align with the Value: order.

-- 
Simon Pieters
Opera Software

Received on Tuesday, 13 August 2013 13:22:10 UTC