@@ -367,68 +367,68 @@ function $CompileProvider($provide) {
367
367
* @returns {?function } A composite linking function of all of the matched directives or null.
368
368
*/
369
369
function compileNodes ( nodeList , transcludeFn , $rootElement , maxPriority ) {
370
- var linkFns = [ ] ,
371
- nodeLinkFn , childLinkFn , directives , attrs , linkFnFound ;
372
-
373
- for ( var i = 0 ; i < nodeList . length ; i ++ ) {
374
- attrs = new Attributes ( ) ;
375
-
376
- // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
377
- directives = collectDirectives ( nodeList [ i ] , [ ] , attrs , maxPriority ) ;
378
-
379
- nodeLinkFn = ( directives . length )
380
- ? applyDirectivesToNode ( directives , nodeList [ i ] , attrs , transcludeFn , $rootElement )
381
- : null ;
382
-
383
- childLinkFn = ( nodeLinkFn && nodeLinkFn . terminal || ! nodeList [ i ] . childNodes . length )
384
- ? null
385
- : compileNodes ( nodeList [ i ] . childNodes ,
386
- nodeLinkFn ? nodeLinkFn . transclude : transcludeFn ) ;
387
-
388
- linkFns . push ( nodeLinkFn ) ;
389
- linkFns . push ( childLinkFn ) ;
390
- linkFnFound = ( linkFnFound || nodeLinkFn || childLinkFn ) ;
391
- }
392
-
393
- // return a linking function if we have found anything, null otherwise
394
- return linkFnFound ? compositeLinkFn : null ;
395
-
396
- function compositeLinkFn ( scope , nodeList , $rootElement , boundTranscludeFn ) {
397
- var nodeLinkFn , childLinkFn , node , childScope , childTranscludeFn ;
398
-
399
- for ( var i = 0 , n = 0 , ii = linkFns . length ; i < ii ; n ++ ) {
400
- node = nodeList [ n ] ;
401
- nodeLinkFn = linkFns [ i ++ ] ;
402
- childLinkFn = linkFns [ i ++ ] ;
403
-
404
- if ( nodeLinkFn ) {
405
- if ( nodeLinkFn . scope ) {
406
- childScope = scope . $new ( isObject ( nodeLinkFn . scope ) ) ;
407
- jqLite ( node ) . data ( '$scope' , childScope ) ;
408
- } else {
409
- childScope = scope ;
410
- }
411
- childTranscludeFn = nodeLinkFn . transclude ;
412
- if ( childTranscludeFn || ( ! boundTranscludeFn && transcludeFn ) ) {
413
- nodeLinkFn ( childLinkFn , childScope , node , $rootElement ,
414
- ( function ( transcludeFn ) {
415
- return function ( cloneFn ) {
416
- var transcludeScope = scope . $new ( ) ;
417
-
418
- return transcludeFn ( transcludeScope , cloneFn ) .
419
- bind ( '$destroy' , bind ( transcludeScope , transcludeScope . $destroy ) ) ;
370
+ var linkFns = [ ] ,
371
+ nodeLinkFn , childLinkFn , directives , attrs , linkFnFound ;
372
+
373
+ for ( var i = 0 ; i < nodeList . length ; i ++ ) {
374
+ attrs = new Attributes ( ) ;
375
+
376
+ // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
377
+ directives = collectDirectives ( nodeList [ i ] , [ ] , attrs , maxPriority ) ;
378
+
379
+ nodeLinkFn = ( directives . length )
380
+ ? applyDirectivesToNode ( directives , nodeList [ i ] , attrs , transcludeFn , $rootElement )
381
+ : null ;
382
+
383
+ childLinkFn = ( nodeLinkFn && nodeLinkFn . terminal || ! nodeList [ i ] . childNodes . length )
384
+ ? null
385
+ : compileNodes ( nodeList [ i ] . childNodes ,
386
+ nodeLinkFn ? nodeLinkFn . transclude : transcludeFn ) ;
387
+
388
+ linkFns . push ( nodeLinkFn ) ;
389
+ linkFns . push ( childLinkFn ) ;
390
+ linkFnFound = ( linkFnFound || nodeLinkFn || childLinkFn ) ;
391
+ }
392
+
393
+ // return a linking function if we have found anything, null otherwise
394
+ return linkFnFound ? compositeLinkFn : null ;
395
+
396
+ function compositeLinkFn ( scope , nodeList , $rootElement , boundTranscludeFn ) {
397
+ var nodeLinkFn , childLinkFn , node , childScope , childTranscludeFn ;
398
+
399
+ for ( var i = 0 , n = 0 , ii = linkFns . length ; i < ii ; n ++ ) {
400
+ node = nodeList [ n ] ;
401
+ nodeLinkFn = linkFns [ i ++ ] ;
402
+ childLinkFn = linkFns [ i ++ ] ;
403
+
404
+ if ( nodeLinkFn ) {
405
+ if ( nodeLinkFn . scope ) {
406
+ childScope = scope . $new ( isObject ( nodeLinkFn . scope ) ) ;
407
+ jqLite ( node ) . data ( '$scope' , childScope ) ;
408
+ } else {
409
+ childScope = scope ;
410
+ }
411
+ childTranscludeFn = nodeLinkFn . transclude ;
412
+ if ( childTranscludeFn || ( ! boundTranscludeFn && transcludeFn ) ) {
413
+ nodeLinkFn ( childLinkFn , childScope , node , $rootElement ,
414
+ ( function ( transcludeFn ) {
415
+ return function ( cloneFn ) {
416
+ var transcludeScope = scope . $new ( ) ;
417
+
418
+ return transcludeFn ( transcludeScope , cloneFn ) .
419
+ bind ( '$destroy' , bind ( transcludeScope , transcludeScope . $destroy ) ) ;
420
420
} ;
421
421
} ) ( childTranscludeFn || transcludeFn )
422
- ) ;
423
- } else {
424
- nodeLinkFn ( childLinkFn , childScope , node , undefined , boundTranscludeFn ) ;
425
- }
426
- } else if ( childLinkFn ) {
427
- childLinkFn ( scope , node . childNodes , undefined , boundTranscludeFn ) ;
428
- }
429
- }
430
- }
431
- }
422
+ ) ;
423
+ } else {
424
+ nodeLinkFn ( childLinkFn , childScope , node , undefined , boundTranscludeFn ) ;
425
+ }
426
+ } else if ( childLinkFn ) {
427
+ childLinkFn ( scope , node . childNodes , undefined , boundTranscludeFn ) ;
428
+ }
429
+ }
430
+ }
431
+ }
432
432
433
433
434
434
/**
0 commit comments