Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28525
| Path | csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Recursive function to find a node in the DOM |
| Date | Thu, 13 Aug 2015 23:26:07 +0200 |
| Organization | solani.org |
| Lines | 42 |
| Message-ID | <mqj218$fvq$1@solani.org> (permalink) |
| References | <mo53os$am9$1@dont-email.me> <5530725.v0RXNFEj4j@PointedEars.de> <mq3qpn$nn$1@solani.org> <1885256.KGaLaWtVka@PointedEars.de> <mqdu4i$sbr$1@solani.org> <4738754.gQ6MLv009L@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | solani.org 1439501160 16378 eJwFwQkBwDAIA0BNoSEbciiPfwm98yOoPspFX1/IugeoGt9zeZQ/9rLKK2IaCGsOs9NS1AMtzxG1 (13 Aug 2015 21:26:00 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Thu, 13 Aug 2015 21:26:00 +0000 (UTC) |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
| X-User-ID | eJwFwQEBwDAIAzBNMNqCnB2YfwlPcGhsBcHAwwtTwqVIsXZ4a6sDo/YvLK+zbfY5Txvg/AED3xBZ |
| In-Reply-To | <4738754.gQ6MLv009L@PointedEars.de> |
| Cancel-Lock | sha1:JBdPB0W4eHzgrFEaZUjfuZuFXZQ= |
| X-NNTP-Posting-Host | eJwNyMkBwCAMA7CVYhLnGKdQvP8IrZ6iJ/JUJDMoCq+JaKunwCWvu3DsxPRck3x3V2EPdfFnfgi/EFc= |
| Xref | csiph.com comp.lang.javascript:28525 |
Show key headers only | View raw
On 12.08.2015 at 01:18, Thomas 'PointedEars' Lahn wrote:
> Christoph M. Becker wrote:
>
>> On 08.08.2015 at 09:33, Thomas 'PointedEars' Lahn wrote:
>>> […] you can do an iterative "user-land" walk of the document tree as
>>> well; for example:
>>>
>>> grandparent ----------------.
>>> ,-- grandparent.firstChild <--'
>>> `---> grandparent.firstChild.firstChild ---------------.
>>> ,----- grandparent.firstChild.firstChild.nextSibling <--'
>>> `-->
>>> grandparent.firstChild.firstChild.nextSibling.parentNode.nextSibling
>>> --> END.
>
>> How can this be done with an iterative algorithm?
>
> You are the reader, you figure it out :-p
Well, you have claimed "you can do an iterative "user-land" walk of the
document tree", so you may care to explain how. :)
I claim that it is not possible to do a purely iterative "user-land"
walk of the document tree, without resorting to let the DOM
implementation flatten the tree structure or by using an explicit (i.e.
user defined and maintained) stack/accumulator. I am not able to prove
that, however.
FWIW, I might do something like the following:
function eachChildOf(node, func) {
node = node.firstChild;
while (node) {
func(node);
eachChildOf(node, func);
node = node.nextSibling;
}
}
--
Christoph M. Becker
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-15 09:59 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-15 11:59 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-15 12:03 +0200
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-15 13:36 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-19 12:27 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-19 12:34 +0200
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 12:08 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-25 14:11 +0200
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-25 21:22 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-27 16:12 +0200
Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-08 04:50 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-08 09:33 +0200
Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-12 00:48 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-12 01:18 +0200
Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-13 23:26 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-16 08:48 +0200
Re: Recursive function to find a node in the DOM "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-08-20 02:11 +0200
Re: Recursive function to find a node in the DOM Scott Sauyet <scott.sauyet@gmail.com> - 2015-07-18 15:59 -0700
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 12:30 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-21 13:53 +0200
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 14:51 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-21 16:05 +0200
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 20:35 +0200
Re: Recursive function to find a node in the DOM Scott Sauyet <scott.sauyet@gmail.com> - 2015-07-30 22:10 -0700
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-08-06 10:07 +0200
Re: Recursive function to find a node in the DOM Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-08-06 20:15 +0200
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-08-08 01:21 +0200
Re: Recursive function to find a node in the DOM Scott Sauyet <scott.sauyet@gmail.com> - 2015-07-30 22:09 -0700
Re: Recursive function to find a node in the DOM Denis McMahon <denismfmcmahon@gmail.com> - 2015-07-29 03:04 +0000
Re: Recursive function to find a node in the DOM "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-08-06 10:20 +0200
csiph-web