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

Le 12/08/2013 07:58, John Daggett a écrit :
> Simon Sapin wrote:
>
>> §8.1 Style rules of css-syntax says:
>>> If a style rule contains multiple declarations with the same name,
>>> all but the last such declaration are discarded.
>>
>> It’s actually not that simple:
>>
>> If a style rule contains multiple declarations for the same longhand
>> property after shorthand expansion [refer to CSS Cascade], all but the
>> one with greatest cascading order [refer to CSS Cascade] are discarded.
>>
>>     Note: within one style rule, the relative cascading order is
>> determined only by '!important', then source order.
>
> Simon, can you give an example of where your definition is not
> equivalent to the current rule in the spec?  I'm trying to see how the
> longhand/shorthand distinction matters and I can't think of an example.


Ok, two examples:

   .foo {
     color: green !important;
     color: red;
   }

In this case, the declaration that is kept (with the greatest cascading 
order) is not the last.


   .bar {
     margin: 1em;
     margin-left: 0;
   }

Here, even though no two specified declarations have the same name, 
there is still some duplication in the longhands: the 'margin-left: 1em' 
declaration implied by the shorthand is ignored.

-- 
Simon Sapin

Received on Monday, 12 August 2013 07:07:07 UTC