Re: [cssom] Need to clarify handling of "priority" argument to CSSStyleDeclaration.setProperty

On Fri, 06 Jul 2012 17:24:56 +0200, Boris Zbarsky <> wrote:

> Consider this testcase:
>    <!DOCTYPE html>
>    <body><div>
>        <script>
>                                                   "2em", null);
>                                                   "italic", "null");
>        </script>
>        Is this twice the size and italic?
>      </div>
>      Normal text
>    </body>
> The first line of text is rendered at 2x the font size of the second one  
> in Gecko, WebKit, Presto, and Trident (IE9 standards mode).  It's also  
> rendered as italic in WebKit and Presto.
> It looks like WebKit and Presto simply allow arbitrary priority values,  
> so I can't tell much about their behavior here.
> It looks like Gecko and Trident only allow valid priority values ("" and  
> "important", treating others like they do syntax errors in values), but  
> treat null as "".
> I suspect that as a minimum for web compat this argument should be  
> listed as [TreatNullAs=EmptyString].

I didn't find instances of null usage in or by quickly  
searching for ".setProperty(" on github. But I've made the change.

> But in general, the behavior for invalid priorities needs to be defined.

It is defined already.

"If priority is neither a valid priority nor the empty string terminate  
this algorithm."

Simon Pieters
Opera Software

Received on Tuesday, 28 May 2013 13:13:08 UTC