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 @@ -575,7 +575,7 @@ function $CompileProvider($provide) {
575
575
if ( directiveValue == 'element' ) {
576
576
$template = jqLite ( compileNode ) ;
577
577
$compileNode = templateAttrs . $$element =
578
- jqLite ( '<!-- ' + directiveName + ': ' + templateAttrs [ directiveName ] + ' -->' ) ;
578
+ jqLite ( document . createComment ( ' ' + directiveName + ': ' + templateAttrs [ directiveName ] + ' ' ) ) ;
579
579
compileNode = $compileNode [ 0 ] ;
580
580
replaceWith ( $rootElement , jqLite ( $template [ 0 ] ) , compileNode ) ;
581
581
childTranscludeFn = compile ( $template , transcludeFn , terminalPriority ) ;
Original file line number Diff line number Diff line change @@ -2222,5 +2222,15 @@ describe('$compile', function() {
2222
2222
expect ( nodeName_ ( comment ) ) . toBe ( '#comment' ) ;
2223
2223
} ) ;
2224
2224
} ) ;
2225
+
2226
+
2227
+ it ( 'should safely create transclude comment node and not break with "-->"' ,
2228
+ inject ( function ( $rootScope ) {
2229
+ // see: https://github.com/angular/angular.js/issues/1740
2230
+ element = $compile ( '<ul><li ng-repeat="item in [\'-->\', \'x\']">{{item}}|</li></ul>' ) ( $rootScope ) ;
2231
+ $rootScope . $digest ( ) ;
2232
+
2233
+ expect ( element . text ( ) ) . toBe ( '-->|x|' ) ;
2234
+ } ) ) ;
2225
2235
} ) ;
2226
2236
} ) ;
You can’t perform that action at this time.
0 commit comments