Re: CSSStyleDeclaration: Setting only a value or a priority

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