fix(view): move nodes into the live document when cloning.

Closes #724
This commit is contained in:
Rado Kirov 2015-02-19 16:18:46 -08:00 committed by Misko Hevery
parent 329b2eda66
commit b1fc3e87c6
3 changed files with 7 additions and 1 deletions

View File

@ -308,7 +308,7 @@ export class ProtoView {
}
_instantiate(hostElementInjector: ElementInjector, eventManager: EventManager): View {
var rootElementClone = this.instantiateInPlace ? this.element : DOM.clone(this.element);
var rootElementClone = this.instantiateInPlace ? this.element : DOM.importIntoDoc(this.element);
var elementsWithBindingsDynamic;
if (this.isTemplateElement) {
elementsWithBindingsDynamic = DOM.querySelectorAll(DOM.content(rootElementClone), NG_BINDING_CLASS_SELECTOR);

View File

@ -187,6 +187,9 @@ class DOM {
node.nodeType == Node.TEXT_NODE;
static bool isElementNode(Node node) =>
node.nodeType == Node.ELEMENT_NODE;
static Node importIntoDoc(Node node) {
return document.importNode(node, true);
}
}
class CSSRuleWrapper {

View File

@ -219,6 +219,9 @@ export class DOM {
static isElementNode(node:Node):boolean {
return node.nodeType === Node.ELEMENT_NODE;
}
static importIntoDoc(node:Node) {
return document.importNode(node, true);
}
}
export class CSSRuleWrapper {