@@ -941,7 +941,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
941
941
return linkFnFound ? compositeLinkFn : null ;
942
942
943
943
function compositeLinkFn ( scope , nodeList , $rootElement , boundTranscludeFn ) {
944
- var nodeLinkFn , childLinkFn , node , $node , childScope , i , ii , n ;
944
+ var nodeLinkFn , childLinkFn , node , $node , childScope , childTranscludeFn , i , ii , n ;
945
945
946
946
// copy nodeList so that linking doesn't break due to live list updates.
947
947
var nodeListLength = nodeList . length ,
@@ -963,17 +963,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
963
963
} else {
964
964
childScope = scope ;
965
965
}
966
-
967
- // We need to create a new boundTranscludeFn if
968
- // - a directive on this element wants to transclude
969
- // or
970
- // - there is no boundTranscludeFn already and a transcludeFn was passed in
971
- if ( nodeLinkFn . transcludeOnThisElement || ( ! boundTranscludeFn && transcludeFn ) ) {
972
- boundTranscludeFn = createBoundTranscludeFn ( scope , nodeLinkFn . transclude || transcludeFn ) ;
966
+ childTranscludeFn = nodeLinkFn . transclude ;
967
+ if ( childTranscludeFn || ( ! boundTranscludeFn && transcludeFn ) ) {
968
+ nodeLinkFn ( childLinkFn , childScope , node , $rootElement ,
969
+ createBoundTranscludeFn ( scope , childTranscludeFn || transcludeFn )
970
+ ) ;
971
+ } else {
972
+ nodeLinkFn ( childLinkFn , childScope , node , $rootElement , boundTranscludeFn ) ;
973
973
}
974
-
975
- nodeLinkFn ( childLinkFn , childScope , node , $rootElement , boundTranscludeFn ) ;
976
-
977
974
} else if ( childLinkFn ) {
978
975
childLinkFn ( scope , node . childNodes , undefined , boundTranscludeFn ) ;
979
976
}
@@ -1349,9 +1346,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
1349
1346
}
1350
1347
1351
1348
nodeLinkFn . scope = newScopeDirective && newScopeDirective . scope === true ;
1352
- nodeLinkFn . transcludeOnThisElement = hasTranscludeDirective ;
1353
- nodeLinkFn . transclude = childTranscludeFn ;
1354
-
1349
+ nodeLinkFn . transclude = hasTranscludeDirective && childTranscludeFn ;
1355
1350
previousCompileContext . hasElementTranscludeDirective = hasElementTranscludeDirective ;
1356
1351
1357
1352
// might be normal or delayed nodeLinkFn depending on if templateUrl is present
0 commit comments