- From: Sander Bos <sander@x-hive.com>
- Date: Wed, 18 Jul 2001 11:43:55 +0200
- To: <www-dom@w3.org>
My answer is a partial testing of the water (seeing if we do the right
thing(tm)).
> Currently, there's no way to add a DOM_Attribute to an
> in-memory DOM tree
> that is an ID, even if it should be according to the DTD. Also, when
I think this is implementation dependent. Implementations may internally
record the type of the attribute, so when DTD information is available
they may be aware that an attribute is a DTD attribute (I don't think
there is a DOM-interface to check the type). In that case you do not
have to specify it explicitly, the DOM will do it..
> importing a DOM_Element that has an ID attribute, the
> attribute is imported
> along with the element, but not recorded as an ID.
Again implementation dependent I think. Also, you must realize with an
import, an attribute may be an ID attribute in one DOM, but not in
another (if the DTDs are different).
> I would like to suggest that either- the DOM_Document should
> check it's
> DocumentType to see if new or imported Attributes should be
> used as an ID
We do this. But this does not have to be in the specification I think,
because the specification only says something about ID-attributes in
Document.getElementById. So for the rest, the DOM-implementation should
simply know what attributes are ID-attributes.
(The ID-information is in the latest AS-specification, although I do not
see how to access this info from an Attr easily).
> to add functionality to specifically request that an
> attribute be treated as
> an ID (e.g. DOM_Document::createIDAttribute()).
This would not work. If I use this DTD
<!ELEMENT myFirstElement ANY>
<!ATTLIST myFirstElement
att1 ID #IMPLIED>
<!ELEMENT mySecondElement ANY>
<!ATTLIST mySecondElement
att1 CDATA #IMPLIED>
and I would do
document.createAttribute("att1");
you would not know whether it is an ID-attribute or not. This is why we
only determine this information when the attribute is linked to an
element (setters).
Kind regards,
--Sander.
--
X-Hive Corporation (www.x-hive.com)
email: sander@x-hive.com
phone: +31 10 7108625
Received on Wednesday, 18 July 2001 05:43:57 UTC