W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2008

Re: name as a standard attribute

From: Patrick Garies <pgaries@fastmail.us>
Date: Mon, 29 Sep 2008 00:08:08 -0500
Message-ID: <48E062B8.5080909@fastmail.us>
To: Omar Syed <osyed1@gmail.com>
CC: www-dom@w3.org

Omar Syed wrote:
>  Are there any plans to make 'name' a standard attribute for all tags
>  similar to 'id' so that unlike 'id' which needs to be unique within
>  the document the 'name' needs to only be locally unique. Thus one can
>  use something like: document.names.s1.p to access element id e3 in
>  this document:
>
>  ... <body> <p id=e1 name=p> <span id=e2 name=s1> <p id=e3 name=p>
>  </span> </body> ....

The |name| attribute isn’t allowed on those elements in HTML 4.01 and is 
deprecated on all elements except form control elements in XHTML 1.0. 
Given that and (I believe) that the HTML 5 Working Group is working on 
the successor to DOM2 HTML, the HTML 5 WG is probably who you want to be 
talking to.

Also, I don’t believe that using |name| attribute values as ECMAScript 
property names is standardized anywhere; the W3C DOM method would be 
|document.getElementsByName("s1").item(0).getElementsByName("p").item(1)|. 
Why you would want to do that instead of |document.getElementById("e3")| 
or |document.getElementById("s1").getElementsByTagName("p").item(0)| is 
beyond me.

— Patrick Garies
Received on Monday, 29 September 2008 05:08:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:59 GMT