- From: Jorgen Horstink <dom@jorgenhorstink.nl>
- Date: Sat, 1 Oct 2005 10:24:34 +0200
- To: www-dom@w3.org
I am totally new to DOM, so sorry for spamming the mailinglist the past two
days.
setIdAttribute
"If the parameter isId is true, this method declares the specified attribute to
be a user-determined ID attribute." [1]
"NOT_FOUND_ERR: Raised if the specified node is not an attribute of this
element." [1]
So this basically implies you cannot register an attribute to be an
user-determined ID attribute when it is not set yet.
Element.setIdAttribute('foo', true); // raises an exception
Element.setAttribute('foo', 'bar');
Document.getElementById('foo'); // won't work
Secondly it implies one can register multiple user-determined ID attributes to
an element. How should a browser vendor implement Docuement.getElementById?
Lookup table are necessary. So then I thought, why is there no getIdAttributes
method on the Element interface? Returning a NodeList of attributes with isId
set true (attributes are notes after all, right?).
I'd extend the IDL Definition:
interface Element : Node {
...
NodeList getIdAttributes();
}
silly idea or not?
-jorgen
[1]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-ElSetIdAttr
Received on Saturday, 1 October 2005 08:24:47 UTC