Re: [CSS21] The grammar of url() token

Anne van Kesteren wrote:
> 
> On Thu, 28 Feb 2008 23:21:13 +0100, Philip Taylor (Webmaster) 
> <P.Taylor@Rhul.Ac.Uk> wrote:
>> and with an /a priori/ knowledge of the extend syntax,
> 
> Sure, my point was about existing parsers (and therefore the implicit 
> likelyhood of existing content depending on it). IE7 doesn't drop the 
> declaration for either a space or comma by the way. (Leading and 
> trailing spaces are trimmed.)
> 

I took a look on the existing specs:


--- CSS 2.1 ---
defined an url(...) as

 URI  url\({w}{string}{w}\)
  |url\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}\)

so theoretically both unescaped spaces or "," *inside* the actual uri - 
e.g. url( a b ) or url(a,b) - should make that invalid and dropped


--- CSS3 Syntax Module (latest Working Draft 13 August 2003) ---
defines it a bit different:

 urlchar ::=  [#x9#x21#x23-#x26#x27-#x7E] | nonascii | escape
 URI  ::=  "url(" w (string | urlchar* ) w ")"

and as , being 0x2c and SPACE being 0x20 would both be a valid urlchar 
and therefor valid in an URI.

Somehow both specs contradict themselves here? And so actually all 
browsers are somehow right depending on what spec they pretend to implement?

But the original suggestion of having multiple values inside an url() is 
still useful but probably should ignore existing browsers which do not 
seem to have a common implementation anyway as Anne wrote. The only 
restriction would be the aforementioned RFC2396 which somehow defines a 
comma a special meaning in an URI and therefor should probably not be 
used as a delimiter of URIs.

----

BTW, it seems strange that urlchar is defined as above (CSS3), probably 
it should be

urlchar ::=  [#x9#x21#x23-#x26#x28-#x7E] | nonascii | escape

as 0x27 being ' should not be allowed the same as " (0x22) which already 
is not allowed.

Also I guess ) 0x29 in an unquoted URI should not be allowed as this 
would prevent the possibility to use URIs in other custom functions like:

 foo(url(x))

The current definition in CSS3 would lead the actual value of the URI 
being "x)" if I understand the definition of urlchar right.

I am not sure what state CSS3 Syntax is in, but I assumed it still a 
spec which eventually will be completed?

----


sorry about all the 0x stuff ;)

christof

Received on Friday, 29 February 2008 22:35:07 UTC