misc/demo/public/vendor/angular-ui-tree/angular-ui-tree.js
function countSubTreeDepth(scope) {
          var thisLevelDepth = 0,
              childNodes = scope.childNodes(),
              childNode,
              childDepth,
              i;
          if (!childNodes || childNodes.length === 0) {
            return 0;
          }
          for (i = childNodes.length - 1; i >= 0 ; i--) {
            childNode = childNodes[i],
            childDepth = 1 + countSubTreeDepth(childNode);
            thisLevelDepth = Math.max(thisLevelDepth, childDepth);
          }
          return thisLevelDepth;
        }
function countSubTreeDepth(scope) {
          var thisLevelDepth = 0,
              childNodes = scope.childNodes(),
              childNode,
              childDepth,
              i;
          if (!childNodes || childNodes.length === 0) {
            return 0;
          }
          for (i = childNodes.length - 1; i >= 0 ; i--) {
            childNode = childNodes[i],
            childDepth = 1 + countSubTreeDepth(childNode);
            thisLevelDepth = Math.max(thisLevelDepth, childDepth);
          }
          return thisLevelDepth;
        }
function countSubTreeDepth ( scope ) { var thisLevelDepth = 0 , childNodes = scope . childNodes ( ) , childNode , childDepth , i ; if ( ! childNodes || childNodes . length === 0 ) { return 0 ; } for ( i = childNodes . length - 1 ; i >= 0 ; i -- ) { childNode = childNodes [ i ] , childDepth = 1 + countSubTreeDepth ( childNode ) ; thisLevelDepth = Math . max ( thisLevelDepth , childDepth ) ; } return thisLevelDepth ; }
Returns the depth of the deepest subtree under this node
@param scope a TreeNodesController scope object
@returns Depth of all nodes *beneath* this node. If scope belongs to a leaf node, the
result is 0 (it has no subtree).
Returns the depth of the deepest subtree under this node