Skip to content

Commit 749a758

Browse files
caitpmhevery
authored andcommitted
fix(browser_adapter): work around WebKit bug with importing template elements
Closes angular#851 Closes angular#853
1 parent 3059104 commit 749a758

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/angular2/src/dom/browser_adapter.es6

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,17 @@ export class BrowserDomAdapter extends DomAdapter {
234234
return node instanceof HTMLElement && isPresent(node.shadowRoot);
235235
}
236236
importIntoDoc(node:Node) {
237-
return document.importNode(node, true);
237+
var result = document.importNode(node, true);
238+
// Workaround WebKit https://bugs.webkit.org/show_bug.cgi?id=137619
239+
if (this.isTemplateElement(result) &&
240+
!result.content.childNodes.length && node.content.childNodes.length) {
241+
var childNodes = node.content.childNodes;
242+
for (var i = 0; i < childNodes.length; ++i) {
243+
result.content.appendChild(
244+
this.importIntoDoc(childNodes[i]));
245+
}
246+
}
247+
return result;
238248
}
239249
isPageRule(rule) {
240250
return rule.type === CSSRule.PAGE_RULE;

0 commit comments

Comments
 (0)