Re: Comment syntax

(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
>> 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="
> /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:

Received on Monday, 3 September 2012 08:25:33 UTC