W3C home > Mailing lists > Public > www-style@w3.org > August 2013

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

From: Simon Sapin <simon.sapin@exyr.org>
Date: Mon, 12 Aug 2013 08:06:38 +0100
Message-ID: <5208897E.207@exyr.org>
To: John Daggett <jdaggett@mozilla.com>
CC: www-style@w3.org
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

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