W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2002

Re: HTML WG Last Call Remarks to DOM 2 HTML

From: Glenn A. Adams <glenn@xfsi.com>
Date: Thu, 18 Apr 2002 15:33:44 -0400
Message-ID: <7249D02C4D2DFD4D80F2E040E8CAF37C3557@longxuyen.xfsi.com>
To: <www-dom@w3.org>
Cc: <w3c-html-wg@w3.org>
I have a comment on the following excerpt:


Message-ID: <009301c1e6e4$9d9600b0$86f5a8c0@srx41p>
From: "Steven Pemberton" <steven.pemberton@cwi.nl <mailto:steven.pemberton@cwi.nl?Subject=Re:%20HTML%20WG%20Last%20Call%20Remarks%20to%20DOM%202%20HTML&In-Reply-To=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e&References=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e> >
To: "Philippe Le Hegaret" <plh@w3.org <mailto:plh@w3.org?Subject=Re:%20HTML%20WG%20Last%20Call%20Remarks%20to%20DOM%202%20HTML&In-Reply-To=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e&References=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e> >, "HTML WG" <w3c-html-wg@w3.org <mailto:w3c-html-wg@w3.org?Subject=Re:%20HTML%20WG%20Last%20Call%20Remarks%20to%20DOM%202%20HTML&In-Reply-To=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e&References=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e> >
Cc: "WWW DOM" <www-dom@w3.org <mailto:www-dom@w3.org?Subject=Re:%20HTML%20WG%20Last%20Call%20Remarks%20to%20DOM%202%20HTML&In-Reply-To=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e&References=%3c009301c1e6e4$9d9600b0$86f5a8c0@srx41p%3e> >
Date: Thu, 18 Apr 2002 16:23:28 +0200
Subject: Re: HTML WG Last Call Remarks to DOM 2 HTML
> > Doubtful Convenience
> > We are not convinced that there is any convenience in certain methods:
> > |HTMLDocument.anchors|: /all/ elements with an |id| are anchors in
> > HTML 4 and XHTML; what is the convenience of only returning the |<a>|
> > elements? Furthermore, since the |name| attribute has no semantics in
> > XHTML, the returned set should /always/ be empty for XHTML documents.
> Even if the name attribute has no semantic in XHTML 1.0, it is still
> part of this language. HTMLDocuments.anchors is kept in the DOM Level 2
> HTML API for backward compatibility reason. We added the following
> sentence:
> "The attribute name was deprecated in XHTML 1.0, therefore it is
> recommend to not use this attribute for XHTML 1.0 documents. Users
> should prefer the iterator mechanisms provided by DOM Level 2 Traversal
> and Range instead."
Well, the problem isn't that it is deprecated. The problem is that if you
use it, it has no effect. People *should* use the name attribute if their
documents are to be compatible with HTML UAs. If the aim of the HTML DOM2 is
to aid this compatibility, then this should be taken into account.

It is not true that the use of ‘name’ has no effect, even for XHTML. In particular, the value of ‘name’ is typically used by existing UAs to create dynamic property members in a script object instance. For example, the following XHTML 1.0 Transitional document when processed by IE6, NN6, and Opera6, correctly report the anchors and links array (collection) entries based on use of the “name” attribute to perform associative lookup on the collection (via the items method).


By the way, the JavaScript usage found below is compatible with browsers as far back as Navigator 2.0 (i.e., any that implement DOM-0). I don’t think you can simply ignore the preponderance of what is essentially “standard practice” in this area.



Glenn Adams


<?xml version="1.0" encoding="utf-8" standalone="no"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">



<script language="javascript" type="text/ecmascript">

function showanchors()


  var msg = "";

  msg += "ANCHORS:\n";

  msg += "a: " + document.anchors.item ( "a" ) + "\n";

  msg += "b: " + document.anchors.item ( "b" ) + "\n";

  alert ( msg );


function showlinks()


  var msg = "";

  msg += "LINKS:\n";

  msg += "a: " + document.links.item ( "a" ) + "\n";

  msg += "b: " + document.links.item ( "b" ) + "\n";

  alert ( msg );






<a href="#b" id="a1" name="a">anchor a</a>

<a href="#a" id="a2" name="b">anchor b</a>



<input type="button" value="Show Anchors" onclick="showanchors()"/>

<input type="button" value="Show Links" onclick="showlinks()"/>







Received on Thursday, 18 April 2002 15:33:17 UTC

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