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

Re: Comment syntax

From: Kang-Hao (Kenny) Lu <kanghaol@oupeng.com>
Date: Mon, 03 Sep 2012 16:25:00 +0800
Message-ID: <5044695C.3090309@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/03 2:33), Liam R E Quin wrote:
> On Tue, 2012-08-28 at 15:08 +0800, Kang-Hao (Kenny) Lu wrote:
>>>> What is attribute value normalization?
>>> In XML and SGML attributes, newlines are converted to spaces by the
>>> parser. E.g. see
>>> http://www.w3.org/TR/REC-xml/#AVNormalize
>> Thanks for the link. So, it's (surprisingly) true that you can't use
>> //-style comments in XHTML. Test cases:
> Note that it's not only XML but also SGML, so that versions of HTML
> defined as SGML vocabularies also, strictly speaking, inherit this
> behaviour. I don't know what HTML 5 and/or "modern Web browsers"
> actually do.

If you change "application/xhtml+xml" to "text/html" in my test case:

>   data:application/xhtml+xml,<body xmlns="http://www.w3.org
> /1999/xhtml" onload="//... %0A alert('hello world')" />

then you'll see the prompt show up. So, modern browsers (at least
WebKit, Firefox and Opera) don't do attribute value normalization.

> It's explained in B.5.1.2 of the SGML spec, if you care :-)

It's explained in Attribute value (double-quoted) state, Attribute value (single-quoted) state and Attribute
value (unquoted) state of the HTML5 spec, if you care :-) (Well, it
doesn't mention this normalization so I assume it doesn't apply by default)

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.

Web Specialist, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/
Received on Monday, 3 September 2012 08:25:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:21 UTC