W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > January to March 2004

id and name should be unique (was: RE: anchors and Bobby)

From: Jewett, Jim J <jim.jewett@eds.com>
Date: Thu, 22 Jan 2004 09:38:38 -0500
Message-ID: <B8CDFB11BB44D411B8E600508BDF076C1A745C03@usahm010.exmi01.exch.eds.com>
To: "'Jon Hanna'" <jon@hackcraft.net>, w3c-wai-ig@w3.org

Jon Hanna wrote:

	There is no need to use the <a> element when 
	you are using id, you can put the id onto any 
	element in the content.

	If maintaining backwards compatibility I'd 
	personally prefer to use id on an element 
	surrounding the section in question, even 
	if name was  still used.

	<p id="intro">
	<a name="intro"></a>introductory paragraph.

An attribute of type ID is supposed to be unique to the
document.  I realize that "name" and "id" are different
attributes, but realistically ... the real reason this seems 
to work is just that most browsers don't actually
enforce uniqueness.  

	<p id="intro" name="intro">text</p>

would be better, except that old browsers probably
won't see the name on anything but <a></a>.  

Perhaps it would make sense to use a convention,
such as prepending "start" to the id when 
creating the otherwise useless target anchor.

	<p id="intro"><a name="startintro"></a>

Then #startintro would be used when you want a
point target (as with navigation), but #intro 
would be used for actions (like CSS) that apply to 
the entire section.

Received on Thursday, 22 January 2004 09:38:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 October 2015 16:21:27 UTC