These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

Is space characters allowed or not allowed in id attr.?

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

Is space characters allowed or not allowed in id attr.?

Postby rniwa » Sat Jun 06, 2009 1:09 am

Hi,

In the spec of the id attribute, it says "The value must not contain any space characters." But then later it says "if the value is not the empty string, user agents must associate the element with the given value (exactly, including any space characters)." It sounds as if the spec. allows space characters to be present in the value of the id attribute.

It should be rephrased something like either "exactly, for historical reasons, including any space characters)" or just "exactly".

Or am I not understanding the spec?
rniwa
<h6>
 
Posts: 1
Joined: Sat Jun 06, 2009 12:58 am
Location: Berkeley, CA

Postby ahagen » Sat Jun 06, 2009 2:06 am

My interpretation is: including a space character in an id attribute results in the document not being valid HTML 5.

User agents must nevertheless match an id with space characters exactly, including the space characters. Even if the document is not valid HTML 5. In this way if the web author makes a mistake, the user agent provides a soft landing.
ahagen
<h5>
 
Posts: 19
Joined: Sat Apr 18, 2009 6:58 pm


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest