W3C home > Mailing lists > Public > www-style@w3.org > July 2009

Re: parsing issue in the editor's draft of css3-image

From: Bert Bos <bert@w3.org>
Date: Mon, 20 Jul 2009 20:22:30 +0200
To: www-style@w3.org
Cc: Yves Lafon <ylafon@w3.org>
Message-Id: <200907202022.30971.bert@w3.org>
On Thursday 16 July 2009, Zack Weinberg wrote:
> fantasai <fantasai.lists@inkedblade.net> wrote:
> > Yves Lafon wrote:
> > > In [1], I found the following example:
> > >
> > > background-image: image(wavy.svg, 'wavy.png' 150dpi, "wavy.gif" 
> > > or blue);
> > >
> > > Should it be image( url(wavy.svg), 'wavy.png' 150dpi, "wavy.gif"
> > > or blue); ?
>
> ...
>
> > > Depending of the intent, it would be good to either add a url()
> > > or to require quotes.
> > > Thanks,
> >
> > CSS3 modules are not required to conform to the CSS2.1 Appendix G
> > grammar, only to the core grammar in Chapter 4. Therefore this is
> > not an issue. A CSS2.1 parser will parse the functional notation as
> > invalid, which is expected.
>
> However, this production introduces another special case in the
> tokenizer and therefore should, IMO, be changed as Yves suggests
> anyway.

I agree, but with a small correction:

It doesn't create a special case, but the obligation for an author to 
escape commas and characters that cannot occur in a value, such as 
unbalanced parentheses and semicolons:

    http://example.org/foo?s10,34;x={}

would have to be written as:

    http://example.org/image?s10\,34\;x=\{\}

(This creates some 13 tokens, if I counted correctly.)

I'm all for omitting parentheses and quotes when possible, but for URLs 
I don't think it is possible.

On the other hand, I think we can drop image() completely. It's too ugly 
for the little gain it offers. How often does it happen that Web 
software knows CSS, but not PNG and JPEG? SVG is still new, but that, 
too, will be pretty much universal soon. For the remaining cases, there 
is HTTP content negotiation. And, if even that doesn't work, well, so 
be it. We're talking about decorations anyway, these images aren't part 
of the content. Maybe the page doesn't look as nice, but it is still 
functional. If it is difficult to read, the user can always turn the 
style sheet off.

If there is a need for a new technology to specify alternatives, then I 
think it is *more* necessary that it works with HTML and other content 
formats than with style sheets. Maybe somebody can create a new (image) 
format that consists of (pointers to) alternatives. A tiny XML-based 
format would do the trick. And to avoid an extra network round trip, it 
can always be put in a data URL.

    File: "myimage.alt"
    <alt>
    <li url="myimage.svg"/>
    <li url="myimage.png"/>
    </alt>



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Monday, 20 July 2009 18:23:10 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:19 GMT