From c9ab8e4be838d2871e7d4eecb71da6d88b4e4618 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Mon, 18 May 2015 15:24:00 -0700 Subject: [PATCH] fix(browser): template elements should have content imported instead of the element itself. --- modules/angular2/src/dom/browser_adapter.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/modules/angular2/src/dom/browser_adapter.ts b/modules/angular2/src/dom/browser_adapter.ts index a53920fd67..8b29a9e41c 100644 --- a/modules/angular2/src/dom/browser_adapter.ts +++ b/modules/angular2/src/dom/browser_adapter.ts @@ -296,16 +296,11 @@ isShadowRoot(node): boolean { return node instanceof DocumentFragment; } importIntoDoc(node: Node) { - var result = document.importNode(node, true); - // Workaround WebKit https://bugs.webkit.org/show_bug.cgi?id=137619 - if (this.isTemplateElement(result) && !this.content(result).childNodes.length && - this.content(node).childNodes.length) { - var childNodes = this.content(node).childNodes; - for (var i = 0; i < childNodes.length; ++i) { - this.content(result).appendChild(this.importIntoDoc(childNodes[i])); - } + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); } - return result; + return document.importNode(toImport, true); } isPageRule(rule): boolean { return rule.type === CSSRule.PAGE_RULE;