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: Fri, 16 Aug 2013 01:01:00 +0200
To: "www-style@w3.org" <www-style@w3.org>, "Peter Sloetjes" <pjs.nl@live.com>
Message-ID: <op.w1vrjyjfidj3kv@simons-macbook-pro.local>
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)

> 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. 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 Thursday, 15 August 2013 22:55:54 UTC

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