W3C home > Mailing lists > Public > www-style@w3.org > September 2012

Re: Comment syntax

From: Kang-Hao (Kenny) Lu <kanghaol@oupeng.com>
Date: Tue, 04 Sep 2012 14:03:50 +0800
Message-ID: <504599C6.30305@oupeng.com>
To: Liam R E Quin <liam@w3.org>
CC: "Zachary “Gamer_Z.” Yaro" <zmyaro@gmail.com>, WWW Style <www-style@w3.org>, "Jens O. Meiert" <jens@meiert.com>
(12/09/04 0:36), Liam R E Quin wrote:
>> Anyway, if you know whether and how and how much XHTML agents handle
>> //-style comments in on* attributes with special care, you might want to
>> share it.
> 
> All XML processors will do the attribute value normalization, so
> anything using the output of an XML parser e.g. to build a DOM tree will
> see attributes as containing spaces, not newlines.
> 
> There's no real possibility of treating some attributes differently.

I meant an agent that outputs XHTML. Perhaps I should have been more
clear. For example, HTML tidy currently converts

  //test
  alert('hello word');

to

  //test alert('hello word');

in @onload, which is obviously a mistake. It can instead either

  1. remove //-style comments in on* attributes.
  2. convert line feeds to character references as suggested by the
polyglot document[1].

> If we'd been designing XML as an HTML replacement we might have
> specified the language differently, but that wasn't our goal :-)
> 
> But since, as you point out, // doesn't work for JavaScript in XHTML,
> maybe it's OK that it won't work for CSS either...

It still kind of depends on the data. If all XHTML agents gracefully do
2. above then this would not have been an issue at all. But that doesn't
seem to be the case...



[1]
http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html#attributes


Cheers,
Kenny
-- 
Web Specialist, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/
Received on Tuesday, 4 September 2012 06:04:18 GMT

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