W3C home > Mailing lists > Public > public-html@w3.org > May 2008

Whitespace in attribute values

From: Andrew Sidwell <w3c@andrewsidwell.co.uk>
Date: Sat, 24 May 2008 17:24:06 +0100
Message-ID: <48384126.9050009@andrewsidwell.co.uk>
To: public-html@w3.org


<!DOCTYPE html>
<a href="   http://google.com/search?q=hello  world     "
    class="   raga taga    " new="   raga  haga  ">meow</a>

I can't find anywhere in the spec which defines how to deal with 
whitespace in attribute values.  Special handling seems to be in 
browsers for the "href" and "class" attributes, and more general 
handling in others.

Opera and Safari3 trim any runs of whitespace in any attribute value 
into just one space character.  Ff3 does this but also then removes any 
leading or trailing spaces from the class attribute.

IE removes all leading or trailing whitespace from the href attribute's 
value, leaving other attribute values as written.

This isn't much of an interoperability issue except in the case of the 
href attribute.  When following the href attribute, all browsers remove 
at least any leading or trailing whitespace and URL-encode the rest, 
even if the DOM has some leading/trailing whitespace.  Behaviour in this 
case should be defined.

Andrew Sidwell
Received on Saturday, 24 May 2008 16:24:44 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:33 UTC