[CSS21] Escaping U, R or L in url() tokens (Was: Re: [css3-syntax] Escaping U, R or L in url() tokens)

On 07/01/2013 15:05, Anton Prowse wrote:
> On 06/01/2013 00:51, Tab Atkins Jr. wrote:
>> On 03/01/2013 16:24, Simon Sapin wrote:
>>>
>>> In both CSS 2.1 and the css3-syntax ED, url( is ASCII case-insensitive
>>> but can not be escaped. This looks deliberate to be, but I’m told that
>>> it could be an oversight.
>
> This is a known issue, filed as
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=17514 (with a bit of
> history of the problem thrown in).
>

>> I've made the changes to the url token

Indeed, the WG resolved[1] to make this change and to errata CSS21.

Here's my attempt at a proposal for CSS21.

In G.2 (Lexical scanner), replace:

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

with:

   | baduri1    {U}{R}{L}\({w}([!#$%&*-\[\]-~]|{nonascii}|{escape})*{w}
   | baduri2    {U}{R}{L}\({w}{string}{w}
   | baduri3    {U}{R}{L}\({w}{badstring}

and replace :

   # "url("{w}{string}{w}")"  {return URI;}
   # "url("{w}{url}{w}")"     {return URI;}

with

   | {U}{R}{L}"("{w}{string}{w}")"  {return URI;}
   | {U}{R}{L}"("{w}{url}{w}")"     {return URI;}


In 4.1.1 (Tokenization), replace:

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

with:

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

and replace:

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

with:

   | baduri1    {U}{R}{L}\({w}([!#$%&*-~]|{nonascii}|{escape})*{w}
   | baduri2    {U}{R}{L}\({w}{string}{w}
   | baduri3    {U}{R}{L}\({w}{badstring}

and insert the following at the end of the list of macros:

   | L    l|\\0{0,4}(4c|6c)(\r\n|[ \t\r\n\f])?|\\l
   | R    r|\\0{0,4}(52|72)(\r\n|[ \t\r\n\f])?|\\r
   | U    u|\\0{0,4}(55|75)(\r\n|[ \t\r\n\f])?|\\u


Note that I lifted the last bit directly from G.2.


[1] http://lists.w3.org/Archives/Public/www-style/2013Jan/0080.html

Cheers,
Anton Prowse
http://dev.moonhenge.net

Received on Monday, 14 January 2013 19:34:29 UTC