@@ -3260,6 +3260,26 @@ describe('$compile', function() {
3260
3260
} ) ) ;
3261
3261
3262
3262
3263
+ it ( 'should not process text nodes merged into their sibling' , inject ( function ( $compile , $rootScope ) {
3264
+ var div = document . createElement ( 'div' ) ;
3265
+ div . appendChild ( document . createTextNode ( '1{{ value }}' ) ) ;
3266
+ div . appendChild ( document . createTextNode ( '2{{ value }}' ) ) ;
3267
+ div . appendChild ( document . createTextNode ( '3{{ value }}' ) ) ;
3268
+
3269
+ element = jqLite ( div . childNodes ) ;
3270
+
3271
+ var initialWatcherCount = $rootScope . $countWatchers ( ) ;
3272
+ $compile ( element ) ( $rootScope ) ;
3273
+ $rootScope . $apply ( 'value = 0' ) ;
3274
+ var newWatcherCount = $rootScope . $countWatchers ( ) - initialWatcherCount ;
3275
+
3276
+ expect ( element . text ( ) ) . toBe ( '102030' ) ;
3277
+ expect ( newWatcherCount ) . toBe ( 3 ) ;
3278
+
3279
+ dealoc ( div ) ;
3280
+ } ) ) ;
3281
+
3282
+
3263
3283
it ( 'should support custom start/end interpolation symbols in template and directive template' ,
3264
3284
function ( ) {
3265
3285
module ( function ( $interpolateProvider , $compileProvider ) {
@@ -8530,10 +8550,38 @@ describe('$compile', function() {
8530
8550
element = $compile ( '<div transclude><div child></div></div>' ) ( $rootScope ) ;
8531
8551
expect ( capturedChildCtrl ) . toBeTruthy ( ) ;
8532
8552
} ) ;
8533
-
8534
8553
} ) ;
8535
8554
8536
8555
8556
+ // See issue https://github.com/angular/angular.js/issues/14924
8557
+ it ( 'should not process top-level transcluded text nodes merged into their sibling' ,
8558
+ function ( ) {
8559
+ module ( function ( ) {
8560
+ directive ( 'transclude' , valueFn ( {
8561
+ template : '<ng-transclude></ng-transclude>' ,
8562
+ transclude : true ,
8563
+ scope : { }
8564
+ } ) ) ;
8565
+ } ) ;
8566
+
8567
+ inject ( function ( $compile ) {
8568
+ element = jqLite ( '<div transclude></div>' ) ;
8569
+ element [ 0 ] . appendChild ( document . createTextNode ( '1{{ value }}' ) ) ;
8570
+ element [ 0 ] . appendChild ( document . createTextNode ( '2{{ value }}' ) ) ;
8571
+ element [ 0 ] . appendChild ( document . createTextNode ( '3{{ value }}' ) ) ;
8572
+
8573
+ var initialWatcherCount = $rootScope . $countWatchers ( ) ;
8574
+ $compile ( element ) ( $rootScope ) ;
8575
+ $rootScope . $apply ( 'value = 0' ) ;
8576
+ var newWatcherCount = $rootScope . $countWatchers ( ) - initialWatcherCount ;
8577
+
8578
+ expect ( element . text ( ) ) . toBe ( '102030' ) ;
8579
+ expect ( newWatcherCount ) . toBe ( 3 ) ;
8580
+ } ) ;
8581
+ }
8582
+ ) ;
8583
+
8584
+
8537
8585
// see issue https://github.com/angular/angular.js/issues/9413
8538
8586
describe ( 'passing a parent bound transclude function to the link ' +
8539
8587
'function returned from `$compile`' , function ( ) {
@@ -9996,6 +10044,39 @@ describe('$compile', function() {
9996
10044
expect ( element . children ( ) . eq ( 2 ) . text ( ) ) . toEqual ( 'dorothy' ) ;
9997
10045
} ) ;
9998
10046
} ) ;
10047
+
10048
+
10049
+ // See issue https://github.com/angular/angular.js/issues/14924
10050
+ it ( 'should not process top-level transcluded text nodes merged into their sibling' ,
10051
+ function ( ) {
10052
+ module ( function ( ) {
10053
+ directive ( 'transclude' , valueFn ( {
10054
+ template : '<ng-transclude></ng-transclude>' ,
10055
+ transclude : { } ,
10056
+ scope : { }
10057
+ } ) ) ;
10058
+ } ) ;
10059
+
10060
+ inject ( function ( $compile ) {
10061
+ element = jqLite ( '<div transclude></div>' ) ;
10062
+ element [ 0 ] . appendChild ( document . createTextNode ( '1{{ value }}' ) ) ;
10063
+ element [ 0 ] . appendChild ( document . createTextNode ( '2{{ value }}' ) ) ;
10064
+ element [ 0 ] . appendChild ( document . createTextNode ( '3{{ value }}' ) ) ;
10065
+
10066
+ var initialWatcherCount = $rootScope . $countWatchers ( ) ;
10067
+ $compile ( element ) ( $rootScope ) ;
10068
+ $rootScope . $apply ( 'value = 0' ) ;
10069
+ var newWatcherCount = $rootScope . $countWatchers ( ) - initialWatcherCount ;
10070
+
10071
+ expect ( element . text ( ) ) . toBe ( '102030' ) ;
10072
+ expect ( newWatcherCount ) . toBe ( 3 ) ;
10073
+
10074
+ if ( msie === 11 ) {
10075
+ expect ( element . find ( 'ng-transclude' ) . contents ( ) . length ) . toBe ( 1 ) ;
10076
+ }
10077
+ } ) ;
10078
+ }
10079
+ ) ;
9999
10080
} ) ;
10000
10081
10001
10082
0 commit comments