Re: [css3-values] Browsers allow unitless lengths in quirks mode

On 2/3/12 11:54 AM, Aryeh Gregor wrote:
> On Thu, Feb 2, 2012 at 3:32 PM, Boris Zbarsky<bzbarsky@mit.edu>  wrote:
>> For what it's worth, the full list of CSS parser quirks-mode behaviors Gecko
>> has is:
>>
>> 1) Unitless lengths allowed in longhands only.
>
> What do you do about things like line-height?  Do you specifically
> exempt them on a case-by-case basis, or is there some general rule
> that suspends this quirk in places where both<length>  and<number>
> are accepted?

The latter.  If <number> is allowed and a number token is encountered, 
then it's treated as a <number>.  Similar for <integer> and integer 
tokens, actually.

>> 2) Hex colors without leading '#' allowed in longhands only.
>
> It seems other browsers support both of these first two things in
> shorthands too.

Yes.  That has the potential to cause a lot more parsing ambiguity 
issues.  For example, only the fact that all the border-style names 
include characters outside [a-f] keeps border-left parsing unambiguous 
if you allow colors without '#' in the shorthand.  While one could just 
have some way of resolving ambiguities similar to the <number> thing 
above, it would be a lot more complicated because subproperties in a 
shorthand can typically come in any order.

That said, there's some sort of weirdness with 'font' where "font: 600 
600 serif" in quirks mode gives you 600px tall text.  That seems like a 
bug in our intended implementation.

> Are there specific cases you're thinking of that might be ambiguous?

David is the right person to ask on that.

> I guess there are no compat issues from your current behavior that you
> know of?

Not that we know of, yeah.

>> 3) Braces around the value of the "style" attribute allowed.
>
> Quirk (3) appears to be supported by Opera, but not IE or WebKit.  Do
> you know if it's really needed for compat?

Interesting.  https://bugzilla.mozilla.org/show_bug.cgi?id=99554 is 
where the quirk was added, and at the time IE most definitely allowed 
curlies in @style.

I just tested IE, and IE9 in "IE9" browser mode and "Quirks" document 
mode does not have this quirk... the first time I load the page.

But IE has the quirk in "Quirks" and "IE7" document modes in all of the 
other three browser modes, and now that I tried those it also has the 
quirk if I put it back in "IE9" browser mode (in the "Quirks" and "IE7" 
document modes).  It's all pretty confusing.

If WebKit in fact doesn't have this quirk, which seems to be the case at 
first glance, then maybe we can remove it without too much in the way of 
compat issues...

-Boris

Received on Friday, 3 February 2012 17:27:38 UTC