JavaScript's strange behavior
<p>If uncomment <code>body.children().each(calc_deep(1));</code> then i get <code>TypeError: Object [object Window] has no method 'attr'</code> on the <code>parseInt(deepest.attr('deep'))</code> string, but without uncomment you can check in console that you can call <code>deepest.attr('deep')</code>. What is that?</p>

<pre><code>    var deepest;
    var calc_deep = function(i)
    {
        $(this).attr('deep',i);
        if(i&gt;parseInt(deepest.attr('deep')))
            deepest=this;
        $(this).children().each(calc_deep(i+1));
    }
    var find_deepest = function()
    {
         body=$('body').children().eq(0);         
         body.attr('deep',0);
         deepest=body;
         //body.children().each(calc_deep(1));
    }
    find_deepest();
</code></pre>
