Hassan S. wrote:
To add a couple of point to this: First the name attribute is deprecated
because it turned out to be a mistake. It server the exact same purpose
as id and it redundant.
Actually not redundant in forms – e.g. radio button elements can
be grouped by a shared name /and/ have unique IDs – but…
From the W3C Specifications for XHTML
4.10. The elements with ‘id’ and ‘name’ attributes
HTML 4 defined the name attribute for the elements a, applet, form,
frame, iframe, img, and map. HTML 4 also introduced the id attribute.
Both of these attributes are designed to be used as fragment
In XML, fragment identifiers are of type ID, and there can only be a
single attribute of type ID per element. Therefore, in XHTML 1.0 the id
attribute is defined to be of type ID. In order to ensure that XHTML 1.0
documents are well-structured XML documents, XHTML 1.0 documents MUST
use the id attribute when defining fragment identifiers on the elements
listed above. See the HTML Compatibility Guidelines for information on
ensuring such anchors are backward compatible when serving XHTML
documents as media type text/html.
Note that in XHTML 1.0, the name attribute of these elements is formally
deprecated, and will be removed in a subsequent version of XHTML.
Yes, the “name” attribute IS deprecated and is scheduled for removal
sometime in the future.
So given that there is not three identifiers there is just one, which is
id. The class attribute does not identify a DOM element.
No, it doesn’t identify a unique DOM element, but …
Identifying something unique is my definition of an object/element
Notice that all id attributes are unique on the page and are used to
identify DOM elements. CSS class names describe the styling and are not
used to identify the DOM elements.
…e.g., you mentioned Prototype, which provides a convenient
getElementsByClassName() method which identifies a set of
or $$(‘css_selector’) works nicely for that in Prototype or just
$(‘css_selector’) in jQuery.