RE: NamedNodeMap

Yes, I've since been informed by others that using members of Node to directly implement the NodeList will not work. I have a separate data structure for this now. It's a little inelegant to perform
the pointer manipulations for each operation twice though; once for the NodeList itself and then again to update the members of Node.

However, I have a new question. Imagine a NodeList is returned by getElementsByTagName. Then a Node in the DOM tree is modified (e.g. replaced, removed, etc). Will these changes be reflected in the
NodeList returned by getElementsByTagName? If so this requires active communication between the DOM and any outstanding NodeLists. Is this true? Is there a way to make the view passive so that no
active updating of outstanding NodeLists is required?

Thanks,
Mike

> -----Original Message-----
> From:	Fred L. Drake, Jr. [SMTP:fdrake@acm.org]
> Sent:	Wednesday, July 11, 2001 2:57 PM
> To:	Allen, Michael B (RSCH)
> Cc:	'www-dom@w3c.org'
> Subject:	Re: NamedNodeMap
> 
> 
> Allen, Michael B (RSCH) writes:
>  > Is a NodeNamedMap ever used to hold anything but the Attrs of an
>  > Element?
> 
>   Yes -- they are used to hold the entity and notation definitions in
> the DocumentType node.
> 
>  >          Might an Attr be an entry in more than one
>  > NamedNodeMap?  A simply way to implement NamedNodeMap in
>  > c is to just add nextAttr and previousAtt members to Node and
>  > make NamedNodeMap a struct like:
> ...
>  > If the answers to the above questions are "no" I don't see a problem
>  > with this technique. Do you?
> 
>   I don't think Attr nodes can appear in more than one map.
> Whether or not this is a reasonable implementation approach depends
> on how you handle default attributes derived from the DTD; if you
> support a DTD, this may not be a good approach, especially if you
> support DOM mutation.
>   (And yes, I think mutation should be a separate feature from simple
> read-access!  But that's a different topic.)
> 
> 
>   -Fred
> 
> -- 
> Fred L. Drake, Jr.  <fdrake at acm.org>
> PythonLabs at Digital Creations
> 

Received on Wednesday, 11 July 2001 16:02:07 UTC