Re: Comment syntax

(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 UTC