Skip to content

Commit b1fc3e8

Browse files
rkirovmhevery
authored andcommitted
fix(view): move nodes into the live document when cloning.
Closes angular#724
1 parent 329b2ed commit b1fc3e8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

modules/angular2/src/core/compiler/view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export class ProtoView {
308308
}
309309

310310
_instantiate(hostElementInjector: ElementInjector, eventManager: EventManager): View {
311-
var rootElementClone = this.instantiateInPlace ? this.element : DOM.clone(this.element);
311+
var rootElementClone = this.instantiateInPlace ? this.element : DOM.importIntoDoc(this.element);
312312
var elementsWithBindingsDynamic;
313313
if (this.isTemplateElement) {
314314
elementsWithBindingsDynamic = DOM.querySelectorAll(DOM.content(rootElementClone), NG_BINDING_CLASS_SELECTOR);

modules/angular2/src/facade/dom.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ class DOM {
187187
node.nodeType == Node.TEXT_NODE;
188188
static bool isElementNode(Node node) =>
189189
node.nodeType == Node.ELEMENT_NODE;
190+
static Node importIntoDoc(Node node) {
191+
return document.importNode(node, true);
192+
}
190193
}
191194

192195
class CSSRuleWrapper {

modules/angular2/src/facade/dom.es6

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ export class DOM {
219219
static isElementNode(node:Node):boolean {
220220
return node.nodeType === Node.ELEMENT_NODE;
221221
}
222+
static importIntoDoc(node:Node) {
223+
return document.importNode(node, true);
224+
}
222225
}
223226

224227
export class CSSRuleWrapper {

0 commit comments

Comments
 (0)