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

Re: Document.getElementById() in XML documents

From: Johnny Stenback <jst@netscape.com>
Date: Tue, 31 Jul 2001 22:37:49 -0700
Message-ID: <3B6795AD.7000803@netscape.com>
To: David Flanagan <david@oreilly.com>
CC: www-dom@w3.org
David Flanagan wrote:

> The DOM Level 2 spec has this to say about Document.getElementById():
> "Note: The DOM implementation must have information that says which
> attributes are of type ID. Attributes with the name "ID" are not of type
> ID unless so defined. Implementations that do not know whether
> attributes are of type ID or not are expected to return null."
> I'm surprised by that last sentence, and I'd like to know whether that
> is actually how things are implemented in practice.  Although I haven't
> done it myself, I gather that the latest web browsers can display XML
> documents when they've got an appropriate stylesheet.  I doubt that
> those browsers are actually going out and parsing a DTD to determine the
> type of each attribute, but I'd also really be surprised if they don't
> just make getElementById() work with attributes named "ID".  In
> practice, this seems like too important a method to break over a
> technicality like this.
> I'd be interested to hear from anyone who can comment on how this issue
> is actually being handled in practice.

For document.getElementById() to work in Mozilla/Netscape6+ when 
document is an XML document you do indeed need to tell mozilla what 
attributes are ID's (and due to bugs in mozilla you need to do this in 
the internal subset).

>     David Flanagan

Received on Thursday, 2 August 2001 05:07:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC