W3C home > Mailing lists > Public > public-html@w3.org > September 2011

[HTML5] '&' in attribute values

From: Andrew Fedoniouk <andrew.fedoniouk@live.com>
Date: Sat, 17 Sep 2011 11:25:04 -0700
Message-ID: <BLU165-ds1411A5F7A9C7C03D5437E2F8090@phx.gbl>
To: "HTML WG" <public-html@w3.org>
That is philosophical question actually ...

Consider this markup:

  <a href="http://domain.com/search?q=whatever&lang=en">link</a>

question is: do we need to escape '&' here (replacing it by &amp; ) ?

According to the parsing rules:
http://www.w3.org/TR/html5/tokenization.html#character-reference-in-attribute-value-state
un-escaped form is an expected sequence here with strictly defined rules of 
handling it.

But validator complains:
http://validator.w3.org/check?uri=http%3A%2F%2Ffiddle.jshell.net%2FRFLR5%2Fshow%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

It should not actually.

Original question for the reference:
http://stackoverflow.com/questions/7456326/what-other-characters-beside-ampersand-should-be-encoded-in-html-href-src-att/7456654#7456654

-- 
Andrew Fedoniouk.

http://terrainformatica.com
Received on Saturday, 17 September 2011 18:25:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:17:38 GMT