Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Recursive function to find a node in the DOM Date: Tue, 21 Jul 2015 13:53:31 +0200 Organization: PointedEars Software (PES) Lines: 54 Message-ID: <1625412.DiW0shChWm@PointedEars.de> References: <4508534.oS5OQyzpKv@PointedEars.de> <4b1cb0ba-f0b0-4b25-a1aa-692c30e69833@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: solani.org 1437479821 27454 eJwFwQERADEIAzBL9Aalk/Mw8C/hkzgEO51Bj40tJZH1Jouuq9vuA2i0Gpvqk0I3vjUZ4/0a4REa (21 Jul 2015 11:57:01 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 21 Jul 2015 11:57:01 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQkBwDAIA0BLfAlUzkrBv4TdwansDIKBxdqUM4H0kbG6fVyL77qwPkSEiHc+4ddkWijwGnaXelbP/CJqFEk= Cancel-Lock: sha1:RrYiM0kske65tATVXWPd6fiNZvw= X-NNTP-Posting-Host: eJwFwYEBwCAIBLGVLD4HjGNV9h/BxCcfO4Qjb+8gxy7TvYb14Jdsxyo4uXqWnEjATume9gcGvBBo Xref: csiph.com comp.lang.javascript:28459 danca (Daniele Campagna) wrote: > Il 07/19/2015 12:59 AM, Scott Sauyet ha scritto: >> Thomas 'PointedEars' Lahn wrote: >>> There is no "javascript". [ ... ] >> >> Keep tilting at that windmill. The rest of us know better. > > :-) So *that* is what you *really* think. Noted. >> Recursion is logically correct here. Nonsense. >> If you're working with modern browsers, you'll have at least a 20000-call >> deep recursion stack.. Cite evidence. And if you are working with not so modern browsers, and not so shallow documents, which you cannot know because with scripting you do not know the environment your code will be exposed to, your code will *break*. So actually you do not need to cite evidence; your argument is that of the blissfully ignorant again. >> If you have a tree that deep in your document, heaven help you. Memory is an issue, too. >> If you have to support IE6 - IE8, >> you'll still get well over 1000 calls deep. It depends not only on the nesting level, but on the stack *size*. >> I don't know about you, but I've never written a document with that much >> nesting. >> >> A recursive solution is clear and elegant. A non-recursive version would >> be much less so. If you make it tail-recursive, when browsers start to >> optimize tail-recursion, the little performance penalty you would >> currently pay for recursion will be eliminated. > > "logically correct" is a part of your answer i like very much, but "a > recursive solution is clear and elegant" is what really made my day ;-) You are easily amused. This "logic" is flawed. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.