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