From 90d9a1df3fac3feb6c87d9425ed122861b68e54a Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Tue, 31 Mar 2015 22:56:45 +0200 Subject: [PATCH] fix(IE11): first fixes Closes #1179 --- modules/angular2/src/dom/browser_adapter.es6 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/angular2/src/dom/browser_adapter.es6 b/modules/angular2/src/dom/browser_adapter.es6 index 3b389a7ebf..69780016c5 100644 --- a/modules/angular2/src/dom/browser_adapter.es6 +++ b/modules/angular2/src/dom/browser_adapter.es6 @@ -56,8 +56,12 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { type(node:string) { return node.type; } - content(node:HTMLTemplateElement):Node { - return node.content; + content(node:HTMLElement):Node { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } } firstChild(el):Node { return el.firstChild; @@ -216,10 +220,10 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { return element.removeAttribute(attribute); } templateAwareRoot(el) { - return el instanceof HTMLTemplateElement ? el.content : el; + return this.isTemplateElement(el) ? this.content(el) : el; } createHtmlDocument() { - return document.implementation.createHTMLDocument(); + return document.implementation.createHTMLDocument('fakeTitle'); } defaultDoc() { return document; @@ -234,7 +238,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { return n instanceof HTMLElement && n.matches(selector); } isTemplateElement(el:any):boolean { - return el instanceof HTMLTemplateElement; + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; } isTextNode(node:Node):boolean { return node.nodeType === Node.TEXT_NODE; @@ -255,10 +259,10 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { var result = document.importNode(node, true); // Workaround WebKit https://bugs.webkit.org/show_bug.cgi?id=137619 if (this.isTemplateElement(result) && - !result.content.childNodes.length && node.content.childNodes.length) { - var childNodes = node.content.childNodes; + !this.content(result).childNodes.length && this.content(node).childNodes.length) { + var childNodes = this.content(node).childNodes; for (var i = 0; i < childNodes.length; ++i) { - result.content.appendChild( + this.content(result).appendChild( this.importIntoDoc(childNodes[i])); } }