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.


Don Park

Received on Monday, 27 July 1998 16:02:58 UTC

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