@@ -926,15 +926,7 @@ function $CompileProvider($provide) {
926
926
childTranscludeFn = nodeLinkFn . transclude ;
927
927
if ( childTranscludeFn || ( ! boundTranscludeFn && transcludeFn ) ) {
928
928
nodeLinkFn ( childLinkFn , childScope , node , $rootElement ,
929
- ( function ( transcludeFn ) {
930
- return function ( cloneFn ) {
931
- var transcludeScope = scope . $new ( ) ;
932
- transcludeScope . $$transcluded = true ;
933
-
934
- return transcludeFn ( transcludeScope , cloneFn ) .
935
- on ( '$destroy' , bind ( transcludeScope , transcludeScope . $destroy ) ) ;
936
- } ;
937
- } ) ( childTranscludeFn || transcludeFn )
929
+ createBoundTranscludeFn ( scope , childTranscludeFn || transcludeFn )
938
930
) ;
939
931
} else {
940
932
nodeLinkFn ( childLinkFn , childScope , node , undefined , boundTranscludeFn ) ;
@@ -943,11 +935,22 @@ function $CompileProvider($provide) {
943
935
childLinkFn ( scope , node . childNodes , undefined , boundTranscludeFn ) ;
944
936
}
945
937
}
938
+
946
939
}
947
940
}
948
941
942
+ function createBoundTranscludeFn ( scope , transcludeFn ) {
943
+ return function boundTranscludeFn ( cloneFn ) {
944
+ var transcludedScope = scope . $new ( ) ,
945
+ clone ;
946
+ transcludedScope . $$transcluded = true ;
947
+ clone = transcludeFn ( transcludedScope , cloneFn ) ;
948
+ clone . on ( '$destroy' , bind ( transcludedScope , transcludedScope . $destroy ) ) ;
949
+ return clone ;
950
+ } ;
951
+ }
949
952
950
- /**
953
+ /**
951
954
* Looks for directives on the given node and adds them to the directive collection which is
952
955
* sorted.
953
956
*
0 commit comments