Re: CSSStyleDeclaration: Setting only a value or a priority

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