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
>>> 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 8.2.4.38 Attribute value (double-quoted) state,
8.2.4.39 Attribute value (single-quoted) state and 8.2.4.40 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.



Cheers,
Kenny
-- 
Web Specialist, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/

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