W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2000

setting Node.prefix

From: Garret Wilson <garret@globalmentor.com>
Date: Fri, 22 Dec 2000 07:14:46 -0800
Message-ID: <004501c06c29$ebc3a3a0$7245a640@pacbell.net>
To: "www-dom list" <www-dom@w3.org>
The documentation for Node.prefix says that Node.prefix will always be null
if (for example) an element was created with DOM Level 1
Document.createElement(). Yet there seems to be no restriction in setting
the prefix (Node.setPrefix()) after the node is created. In this case, it
appears the Node.name property is changed as well to reflect the new prefix.

I don't think it's clear what exactly happens to the related namespace
values in this case. For example:

1. In all elements, does setting Node.nodeName update Node.prefix? (Why not?
The converse is true, after all.)

2. In all elements, does setting Node.nodeName update Node.localName? (If #1
is true, then this should be the case for consistency.)

3. If #1 and #2 are true, then setting the prefix of an Element created with
DOM Level 1 to a non-null value *should* update Node.localName as well,

In other words, I would assume that, if the following takes place, the
corresponding value changes will occur):

Step 1: Document document=myDocument.createElement("myNS:myElement")
{nodeName="myNS:myElement"; prefix=null; localName=null;}

Step 2: myDocument.setPrefix("yourNS") {nodeNS="yourNS:myElement";
prefix="yourNS"; localName="myElement"}

This seems logical to me, but it's not stated in the DOM Level 2 Core
Specification Version 1.0. Are my assumptions correct?

Received on Friday, 22 December 2000 10:15:21 UTC

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