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

Re: CSSStyleDeclaration: Setting only a value or a priority

From: Simon Pieters <simonp@opera.com>
Date: Sun, 18 Aug 2013 23:25:34 +0200
To: "www-style@w3.org" <www-style@w3.org>, "Peter Sloetjes" <pjs.nl@live.com>
Message-ID: <op.w1064wyzidj3kv@simons-macbook-pro.local>
On Fri, 16 Aug 2013 01:01:00 +0200, Simon Pieters <simonp@opera.com> wrote:

> On Thu, 15 Aug 2013 22:30:10 +0200, Simon Pieters <simonp@opera.com>  
> wrote:
>
>> Another option is to let setProperty(value) i.e. with the second  
>> argument omitted leave the priority alone.
>
> Oops, I meant setProperty(property, value)

I've now specced this. https://dvcs.w3.org/hg/csswg/rev/1a4eaf3f7f1d

>> This would be a change in behavior, but the current behavior seems  
>> unexpected and is likely to result in buggy code. Does anyone know if  
>> there are pages that would break if setProperty(value) (or with the  
>> property = value; syntax) would *not* unset !important ?
>
> This seems unlikely since IE10/WebKit/Blink don't do that. Instead they  
> do nothing for style[property] = value or style.setProperty(property,  
> value, '') if property is !important. To unset !important, you have to  
> call removeProperty first.
>
> There might be pages that rely on that behavior, of course, but then  
> they would be broken in Gecko/Presto, which follow the spec.
>
> I could see an argument for doing what IE10/WebKit/Blink do.

OTOH it's not behavior I would expect.

> If you set something to !important, you don't want it overridden by  
> declarations that are not !important. Should we change the spec? (If we  
> do, that would rule out my proposal above, but we could go with  
> something else to opt in.)
>


-- 
Simon Pieters
Opera Software
Received on Sunday, 18 August 2013 21:20:18 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 18 August 2013 21:20:20 UTC