This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -581,7 +581,7 @@ function $CompileProvider($provide) {
581
581
if ( directiveValue == 'element' ) {
582
582
$template = jqLite ( compileNode ) ;
583
583
$compileNode = templateAttrs . $$element =
584
- jqLite ( '<!-- ' + directiveName + ': ' + templateAttrs [ directiveName ] + ' -->' ) ;
584
+ jqLite ( document . createComment ( ' ' + directiveName + ': ' + templateAttrs [ directiveName ] + ' ' ) ) ;
585
585
compileNode = $compileNode [ 0 ] ;
586
586
replaceWith ( $rootElement , jqLite ( $template [ 0 ] ) , compileNode ) ;
587
587
childTranscludeFn = compile ( $template , transcludeFn , terminalPriority ) ;
Original file line number Diff line number Diff line change @@ -2241,5 +2241,15 @@ describe('$compile', function() {
2241
2241
expect ( nodeName_ ( comment ) ) . toBe ( '#comment' ) ;
2242
2242
} ) ;
2243
2243
} ) ;
2244
+
2245
+
2246
+ it ( 'should safely create transclude comment node and not break with "-->"' ,
2247
+ inject ( function ( $rootScope ) {
2248
+ // see: https://github.com/angular/angular.js/issues/1740
2249
+ element = $compile ( '<ul><li ng-repeat="item in [\'-->\', \'x\']">{{item}}|</li></ul>' ) ( $rootScope ) ;
2250
+ $rootScope . $digest ( ) ;
2251
+
2252
+ expect ( element . text ( ) ) . toBe ( '-->|x|' ) ;
2253
+ } ) ) ;
2244
2254
} ) ;
2245
2255
} ) ;
You can’t perform that action at this time.
0 commit comments