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>
Joe,

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


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
legitimate
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
string.

Best,

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:45 GMT