Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit e336b80

Browse files
committed
Test for SVG-ness in ngIncludeFillContent linkFn
1 parent 692fb7f commit e336b80

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ng/directive/ngInclude.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,20 @@ var ngIncludeFillContentDirective = ['$compile',
267267
priority: -400,
268268
require: 'ngInclude',
269269
link: function(scope, $element, $attr, ctrl) {
270-
$element.empty();
271-
$element.append(jqLite(jqLiteBuildFragment(ctrl.template, document).childNodes));
270+
var isSVGElement = /SVG/.test($element[0].toString());
271+
272+
if (isSVGElement) {
273+
// WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
274+
// support innerHTML, so detect this here and try to generate the contents
275+
// specially.
276+
$element.empty();
277+
$element.append(jqLiteBuildFragment(ctrl.template, document).childNodes);
278+
$compile($element.contents())(scope, function namespaceAdaptedClone(clone) {
279+
$element.append(clone);
280+
}, undefined, undefined, $element);
281+
return;
282+
}
283+
$element.html(ctrl.template);
272284
$compile($element.contents())(scope, undefined, null, null, $element);
273285
}
274286
};

0 commit comments

Comments
 (0)