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

Re: Consensus on the gray areas of the DOM API

From: Don Park <donpark@quake.net>
Date: Mon, 12 Oct 1998 17:40:49 -0700
Message-ID: <000601bdf642$2528d7b0$2ee044c6@arcot-main>
To: <www-dom@w3.org>

>You remember almost correctly... Apologies if I was unclear; let's try it

Heck, this is one gray area that requires a lot of words to clarify.  We
were standing practically next to each other <g>

>Just so folks know how I'm biased: In my implementation, a newly-created
>Attr has no children, and Attr.setValue("") replaces the previous contents
>(if any) with an empty text node. Both cases return "" as their getValue()
>response. For now, setValue(null) happens to reset the Attr back to its
>no-children case ... that's a behavior definitely not covered by the REC,
>but I hate the thought of throwing an exception when there's a reasonable
>interpretation of the request.

In my implementation,

1. a newly-created Attr has no children (hit!)

2. an Attr with no children is a legitimate object. It should have a
getLength() value of 0, and return false when asked hasChildNodes (hit!)

3. an Attr with one child, that being an empty Text node, is also a
object. It should have a getLength() value of 1, and return true when asked
hasChildNodes (hit!)

4. getValue() returns "" for both no-children and any number of empty text
node childrens (hit!)

5. Attr.setValue("") reset the Attr  back to its no-children case (miss!)

6. Attr.setValue(null)  throws NullPointerException (miss!).

Your use of the word 'legitimate' was critical, I think, in enhancing
clarity here.  As far as setValue is concerned, I just couldn't see any
value of having setValue("") resulting in a single text node with empty


Don Park
Received on Monday, 12 October 1998 20:41:24 UTC

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