This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -581,7 +581,7 @@ function $CompileProvider($provide) {
581581 if ( directiveValue == 'element' ) {
582582 $template = jqLite ( compileNode ) ;
583583 $compileNode = templateAttrs . $$element =
584- jqLite ( '<!-- ' + directiveName + ': ' + templateAttrs [ directiveName ] + ' -->' ) ;
584+ jqLite ( document . createComment ( ' ' + directiveName + ': ' + templateAttrs [ directiveName ] + ' ' ) ) ;
585585 compileNode = $compileNode [ 0 ] ;
586586 replaceWith ( $rootElement , jqLite ( $template [ 0 ] ) , compileNode ) ;
587587 childTranscludeFn = compile ( $template , transcludeFn , terminalPriority ) ;
Original file line number Diff line number Diff line change @@ -2241,5 +2241,15 @@ describe('$compile', function() {
22412241 expect ( nodeName_ ( comment ) ) . toBe ( '#comment' ) ;
22422242 } ) ;
22432243 } ) ;
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+ } ) ) ;
22442254 } ) ;
22452255} ) ;
You can’t perform that action at this time.
0 commit comments