Path: csiph.com!goblin1!goblin.stu.neva.ru!news.albasani.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: Recursive function to find a node in the DOM Date: Sat, 08 Aug 2015 04:50:42 +0200 Organization: solani.org Lines: 15 Message-ID: References: <5530725.v0RXNFEj4j@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1439002231 759 eJwFwYERgDAIA8CVAgmpHUfw2H8E/4sOz5HLqq3tjB5Akk88pD8S93tj2N07nTDWKN6MTf0IYhBL (8 Aug 2015 02:50:31 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 8 Aug 2015 02:50:31 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 X-User-ID: eJwFwYEBwCAIA7CXRNoyzmEK/59gQpfpBESBw4nmus61B8SWTY9ludoNN7vuvzM0gZP+FfEAD1EQrw== In-Reply-To: <5530725.v0RXNFEj4j@PointedEars.de> Cancel-Lock: sha1:Km3JqJUohUcBsg5+VJxffw+VFCw= X-NNTP-Posting-Host: eJwFwYEBACAEBMCViPcZJ9L+I3QHC42mB8Lx8GZWHRGeXPuatGmileg9yYJaBsvn+m1hUT4YKRDQ Xref: csiph.com comp.lang.javascript:28508 On 15.07.2015 at 11:59, Thomas 'PointedEars' Lahn wrote: > […] And the proper approach here is iteration (walking the > document tree), not recursion; because the stack size and/or nesting level > is limited (the Google Groups archive has test results), but an element’s > nesting level within a document tree is not. Frankly, I do not get the point here. Wouldn't the DOM implementation have to *recursively* walk the DOM to find the desired elements as well? Of course, that would likely need less stack space than a recursive *user-land* walk, but still be of the same order of magnitude. -- Christoph M. Becker