Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28501

Re: Recursive function to find a node in the DOM

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it>
Newsgroups comp.lang.javascript
Subject Re: Recursive function to find a node in the DOM
Date Thu, 6 Aug 2015 10:07:37 +0200
Organization A noiseless patient Spider
Lines 66
Message-ID <mpv4ml$blj$1@dont-email.me> (permalink)
References <mo53os$am9$1@dont-email.me> <4508534.oS5OQyzpKv@PointedEars.de> <4b1cb0ba-f0b0-4b25-a1aa-692c30e69833@googlegroups.com> <mol6so$48v$1@dont-email.me> <1625412.DiW0shChWm@PointedEars.de> <molf6c$2l1$1@dont-email.me> <1516357.lIjpcpmlPf@PointedEars.de> <4be984b1-7744-4271-acd8-a6a625977504@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 6 Aug 2015 08:08:53 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="73d001b620431323711398aa43751982"; logging-data="11955"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BVn8FN4Ofi2bZq2Rcvdk4"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <4be984b1-7744-4271-acd8-a6a625977504@googlegroups.com>
Cancel-Lock sha1:SA0uM5OwzxItK2d2jNcoiz0zjNE=
Xref csiph.com comp.lang.javascript:28501

Show key headers only | View raw


Il 07/31/2015 07:10 AM, Scott Sauyet ha scritto:
> Thomas 'PointedEars' Lahn wrote:
>> danca (Daniele Campagna) wrote:
>>
>>> And it is referred to an old thread, too, in wich Scott was humorous about
>>> that [not sure he remembers the thread and me anyway]. So I believe to $
>>> know he is usually quite benign and more on the side of humour than on the
>>> one of sarcasm.
>
> "usually quite benign"?  How am I going to live that down among my fellow
> cutthroats, brigands and hooligans?  :-)
>

Just hope they don't read this NG! :-)

> -----
>
> So while we're on the subject, here's my theory of why Mr. Lahn decided
> to continue arguing against recursion here.  I'm afraid it's not very
> flattering.
>
> In the intial response to the OP, who was asking about the need to return
> the value from the function, Thomas replied,
>
> | Of course you need a break condition to prevent infinite recursion;
>
> This was a mistake. It had nothing to do with the question, which was
> about argument evaluation strategy, and Javascript's use of
> call-by-sharing.

I had the same suspect.

>
> My response answered the OP and rebutted Mr. Lahn's point on recursion.
> But he couldn't leave it at that because he really does not like to be
> corrected, unless it's about the most specific, verifiable, documented
> details of something. Anything else, he'll choose to argue, and will as
> often as not, make his response insulting, or at minimum, patronizing.
>
> I wonder if this sounds as likely to others as it does to me.
>
>    -- Scott
>

I copy/paste the following paragraph, extracted from a mail I sent 
someone, on the subject:

----
But: one last consideration about the risk to crash due to wild increase 
of the call stack.
You seems to think that if a document has a zillion nodes, the recursive 
function will create a zillion of calls and subsequently a stack of a 
zillion elements. It is not the case. What really matter is how deep is 
a nested node from the starting node, because the algorythm calls itself 
only to go to the next child node, but returns (and decreases the call 
stack) when the current branch of the tree ends!!

So I really don't think that a DOM can have a node nested more than, 
say, a few dozen of levels, and this is the maximum amount the stack 
will reach!
----

Dan
-- 
"Everybody should pay taxes with a smile"
I tried, but they want money.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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