Re: [css3-syntax] Thoughts on proposed Syntax module

(12/08/30 1:17), Tab Atkins Jr. wrote:
> On Wed, Aug 29, 2012 at 8:58 AM, Kang-Hao (Kenny) Lu
>> Ah, it means that WebKit doesn't implement BAD_STRING. See, for example,
>> this test case[2], where
>>
>>   "; background: green; }
>>
>> is tokenized into
>>
>>   DELIM(;) IDENT(background)
>>
>> in WebKit instead of
>>
>>   BAD_STRING("; background: green; })
>>
>> as required by both CSS 2.1 and the current css3-syntax.
> 
> No, it just means our parsing is retarded, and is relying on some
> weird detail. 

Any detail is explainable.

> Again, it's the presence or absence of a newline that
> causes this.  You can put the newline literally *anywhere* after the "
> (well, anywhere whitespace is allowed), and you get the effect.

I am adding another test case[3]. In this test case,

  <style>body { background: red; url(a "); background: green; }"
</style>

, nothing will change if you remove the line break before </style>. It
does change when you add a line break before the closing ".

Anyway, what WebKit is doing here is that it tokenizes

  url(a "); background: green; }"

into

  BAD_URI - url(
  STRING - "); background: green; }"

, pretty much like what other browsers do, instead of

  BAD_URI - url(a ")
  DELIM - ;
  IDENT - background
  ...

as what css3-syntax requires. When the closing " is missing,

  url(a "); background: green; }

is mistakenly tokenized by WebKit as

  BAD_URI - url(a
  DELIM - )
  DELIM - ;
  IDENT - background
  ...

, which  s very close to what CSS 2.1 required before Issue 129[4] when
BAD_STRING was introduced:

  BAD_URI - url(a
  DELIM - "
  DELIM - )
  DELIM - ;
  IDENT - background
  ...

(in fact, it's indistinguishable), so I wouldn't call this retarded.

[3] http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1726
[4] http://wiki.csswg.org/spec/css2.1#issue-129



Cheers,
Kenny
-- 
Web Specialist, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/

Received on Wednesday, 29 August 2012 17:51:03 UTC