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

On Fri, 06 Jul 2012 17:24:56 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> Consider this testcase:
>
>    <!DOCTYPE html>
>    <body><div>
>        <script>
>        document.body.firstChild.style.setProperty("font-size",
>                                                   "2em", null);
>        document.body.firstChild.style.setProperty("font-style",
>                                                   "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 webdevdata.org or by quickly  
searching for ".setProperty(" on github. But I've made the change.  
https://dvcs.w3.org/hg/csswg/rev/9404a23a6d35

> 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