Omar Syed | 28 Sep 19:21

name as a standard attribute

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>
....

Thanks.

Omar

keshlam | 29 Sep 03:52
Favicon

Re: name as a standard attribute


I haven't heard of any plans to extend the DOM API, and that kind of test would probably be considered out of scope.

Sounds like you should be using the DOM's XPath API -- if your DOM supports it -- and writing an XPath to the node you're interested in.  That would give you richer search capabilities.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
 -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://www.ovff.org/pegasus/songs/threes-rev-11.html)
Patrick Garies | 29 Sep 07:08
Favicon

Re: name as a standard attribute


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


Gmane