This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -267,19 +267,17 @@ var ngIncludeFillContentDirective = ['$compile',
267267 priority : - 400 ,
268268 require : 'ngInclude' ,
269269 link : function ( scope , $element , $attr , ctrl ) {
270- var isSVGElement = / S V G / . test ( $element [ 0 ] . toString ( ) ) ;
271-
272- if ( isSVGElement ) {
270+ if ( / S V G / . test ( $element [ 0 ] . toString ( ) ) && nodeName_ ( $element [ 0 ] ) !== 'foreignobject' ) {
273271 // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
274272 // support innerHTML, so detect this here and try to generate the contents
275273 // specially.
276- $element . empty ( ) ;
277- $element . append ( jqLiteBuildFragment ( ctrl . template , document ) . childNodes ) ;
278- $compile ( $element . contents ( ) ) ( scope , function namespaceAdaptedClone ( clone ) {
274+ $compile ( jqLiteBuildFragment ( ctrl . template , document ) . childNodes ) ( scope ,
275+ function namespaceAdaptedClone ( clone ) {
279276 $element . append ( clone ) ;
280277 } , undefined , undefined , $element ) ;
281278 return ;
282279 }
280+
283281 $element . html ( ctrl . template ) ;
284282 $compile ( $element . contents ( ) ) ( scope ) ;
285283 }
Original file line number Diff line number Diff line change @@ -603,11 +603,11 @@ describe('ngInclude and transcludes', function() {
603603 } ) ;
604604 inject ( function ( $compile , $rootScope , $httpBackend ) {
605605 $httpBackend . expectGET ( 'my-rect.html' ) . respond ( '<g ng-include="\'include.svg\'"></g>' ) ;
606- $httpBackend . expectGET ( 'include.svg' ) . respond ( '<rect></rect>' ) ;
606+ $httpBackend . expectGET ( 'include.svg' ) . respond ( '<rect></rect><rect></rect> ' ) ;
607607 element = $compile ( '<svg><test></test></svg>' ) ( $rootScope ) ;
608608 $httpBackend . flush ( ) ;
609609 var child = element . find ( 'rect' ) ;
610- expect ( child . length ) . toBe ( 1 ) ;
610+ expect ( child . length ) . toBe ( 2 ) ;
611611 expect ( child [ 0 ] instanceof SVGRectElement ) . toBe ( true ) ;
612612 } ) ;
613613 } ) ;
You can’t perform that action at this time.
0 commit comments