nl_tokens: Compile function matches each node in nodeList against the directives . Once all directives for a particular node are collected their compile functions are executed . The compile functions return values - the linking functions - are combined into a composite linking function which is the a linking function for the node .
pl_tokens: function compileNodes ( nodeList , transcludeFn , $rootElement , maxPriority , ignoreDirective ) { var linkFns = [ ] , nodeLinkFn , childLinkFn , directives , attrs , linkFnFound ; for ( var i = 0 ; i < nodeList . length ; i ++ ) { attrs = new Attributes ( ) ; // we must always refer to nodeList[i] since the nodes can be replaced underneath us. directives = collectDirectives ( nodeList [ i ] , [ ] , attrs , i == 0 ? maxPriority : undefined , ignoreDirective ) ; nodeLinkFn = ( directives . length ) ? applyDirectivesToNode ( directives , nodeList [ i ] , attrs , transcludeFn , $rootElement ) : null ; childLinkFn = ( nodeLinkFn && nodeLinkFn . terminal || ! nodeList [ i ] . childNodes || ! nodeList [ i ] . childNodes . <mask> ) ? null : compileNodes ( nodeList [ i ] . childNodes , nodeLinkFn ? nodeLinkFn . transclude : transcludeFn ) ; linkFns . push ( nodeLinkFn ) ; linkFns . push ( childLinkFn ) ; linkFnFound = ( linkFnFound || nodeLinkFn || childLinkFn ) ; } // return a linking function if we have found anything, null otherwise return linkFnFound ? compositeLinkFn : null ; function compositeLinkFn ( scope , nodeList , $rootElement , boundTranscludeFn ) { var nodeLinkFn , childLinkFn , node , childScope , childTranscludeFn , i , ii , n ; // copy nodeList so that linking doesn't break due to live list updates. var stableNodeList = [ ] ; for ( i = 0 , ii = nodeList . length ; i < ii ; i ++ ) { stableNodeList . push ( nodeList [ i ] ) ; } for ( i = 0 , n = 0 , ii = linkFns . length ; i < ii ; n ++ ) { node = stableNodeList [ n ] ; nodeLinkFn = linkFns [ i ++ ] ; childLinkFn = linkFns [ i ++ ] ; if ( nodeLinkFn ) { if ( nodeLinkFn . scope ) { childScope = scope . $new ( isObject ( nodeLinkFn . scope ) ) ; jqLite ( node ) . data ( '$scope' , childScope ) ; } else { childScope = scope ; } childTranscludeFn = nodeLinkFn . transclude ; if ( childTranscludeFn || ( ! boundTranscludeFn && transcludeFn ) ) { nodeLinkFn ( childLinkFn , childScope , node , $rootElement , ( function ( transcludeFn ) { return function ( cloneFn ) { var transcludeScope = scope . $new ( ) ; transcludeScope . $$transcluded = true ; return transcludeFn ( transcludeScope , cloneFn ) . on ( '$destroy' , bind ( transcludeScope , transcludeScope . $destroy ) ) ; } ; } ) ( childTranscludeFn || transcludeFn ) ) ; } else { nodeLinkFn ( childLinkFn , childScope , node , undefined , boundTranscludeFn ) ; } } else if ( childLinkFn ) { childLinkFn ( scope , node . childNodes , undefined , boundTranscludeFn ) ; } } } }