Re: [CSS2.1] syntax: url() and unexpected end of (line / style sheet)

On Wednesday 2008-05-14 12:16 -0700, Zachary Weinberg wrote:
> ----- "Christof Hoeke" <csad7@t-online.de> wrote:
> > 
> > the question remains *why* URI is a token and why the definition for 
> > FUNCTION is not used instead, it would actually simplify the tokenizer
> > as well.
> 
> Yeah, I would like to know that myself - but even if it remains
> a token, it could be changed to use the same completion rules as
> FUNCTION.

I suspect the rationale for it being a token was to allow the whole
thing to appear as something simple to parse (i.e., not a long and
complicated sequence of tokens) without requiring authors to put the
contents of url() inside quotation marks (which would make it into a
single string token.

> > I always explained it to myself that if an URI is cut off it may be 
> > totally different than the value meant and so better be removed 
> > altogether (contrived examply: e.g. "url(some.gif.jpg)" could be cut 
> > e.g. "url(some.gif" and if the completion rule of FUNCTION would be
> > used would end up "url(some.gif)"...)
> 
> This argument can be applied to *all* constructs not
> properly closed at EOF.  E.g. rgb(12,12,12<EOF> maybe should have been
> rgb(12,12,129) which is a very different color.

Allowing constructs that were unclosed to be valid when terminated
by EOF is new in CSS 2.1 (I think mainly for compatibility with
existing browsers other than Gecko); I don't think that was part of
the design rationale.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Wednesday, 14 May 2008 19:28:11 UTC