[HTML5] '&' in attribute values

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 UTC