W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998

Re: Implementing NodeList

From: Don Park <donpark@quake.net>
Date: Mon, 27 Jul 1998 12:54:21 -0700
Message-ID: <00d901bdb998$5ee70d50$2ee044c6@arcot-main>
To: <keshlam@us.ibm.com>, <www-dom@w3.org>
>For example: If I'm iterating through the NodeList, and in response to
>processing a node I find I have to insert structure earlier in the DOM,
>that's going to blow my iteration loop out of the water -- the indices
>shift, and I'll wind up re-processing earlier nodes -- unless I add code to
>search forward in the NodeList to re-establish my position. Conversely, if
>I delete an earlier node I may skip processing something unless I search
>back. Either can be solved by processing into a second tree, I suppose...
>but if you weren't updating the source tree, the NodeList wouldn't have to
>be live.

Its simpler than it seems.  Each insertion or removal involves incrementing
or decrementing the index by one.

>But if you tell me that script writers want it to work this way, I'll take
>your word for it; you've been looking at this much longer than I.

I find that, while script writers are easily annoyed by seemingly unfamiliar
features, they are amazingly patient with familiar features which are
difficult to use.

Regards,

Don Park
CTO/Docuverse

>
>
>
Received on Monday, 27 July 1998 16:02:58 GMT

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