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

Re: HTML5 draft: id attribute question

From: Smylers <Smylers@stripey.com>
Date: Sat, 26 Jan 2008 21:35:23 +0000
To: public-html@w3.org
Message-ID: <20080126213523.GC19713@stripey.com>

David Naylor writes:

> I was reading through the current HTML 5 draft, and these two paragraphs 
> about the ID attribute confuse me:
>
> "The id attribute represents its element's unique identifier. The
> value must be unique in the subtree within which the element finds
> itself and must contain at least one character. The value must not
> contain any space characters 

That's telling authors not to put space characters in id attributes.

> If the value is not the empty string, user agents must associate the
> element with the given value (exactly, including any space characters)
> for the purposes of ID matching within the subtree the element finds
> itself (e.g. for selectors in CSS or for the |getElementById()| method
> in the DOM)."

That's telling user agents what to do with id attributes (note it says
"user agents must ..."), including what to do if they have spaces
(because an author disobeyed the first paragraph you quoted).

> So, are space characters allowed or not?

There are many things which authors are not allowed to do but which they
do (consider how much of the current web doesn't meet the specs), so to
ensure consistent behaviour the spec specifies how user agents should
behave when they meet them.  Hope that helps.

Smylers
Received on Saturday, 26 January 2008 21:35:50 UTC

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