RE: CSSStyleDeclaration: Setting only a value or a priority

On Sun, 18 Aug 2013 23:25:34 +0200, Simon Pieters <simonp@opera.com> wrote:

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

Ah, very nice, interpreting 'undefined' as 'do nothing' seems reasonable and easy to remember. At least users can use setProperty in the future to avoid changing rule priorities.

For the "[property] = value" syntax, one could require an extra space character " " at the end to indicate that the property priority should be changed to "", while leaving it unchanged when no space is added. After all, an extra space is required for setting "!important" as well. Not setting priorities leads to much less side effects and is perhaps what most users want to do most of the time.

PJS, Firefox add-on developer.

> To: www-style@w3.org; pjs.nl@live.com
> Subject: Re: CSSStyleDeclaration: Setting only a value or a priority
> Date: Sun, 18 Aug 2013 23:25:34 +0200
> From: simonp@opera.com
> 
> 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 Monday, 19 August 2013 14:28:18 UTC