fix(browser): template elements should have content imported instead of the element itself.
This commit is contained in:
parent
1054f6a9ab
commit
c9ab8e4be8
|
@ -296,16 +296,11 @@ isShadowRoot(node): boolean {
|
||||||
return node instanceof DocumentFragment;
|
return node instanceof DocumentFragment;
|
||||||
}
|
}
|
||||||
importIntoDoc(node: Node) {
|
importIntoDoc(node: Node) {
|
||||||
var result = document.importNode(node, true);
|
var toImport = node;
|
||||||
// Workaround WebKit https://bugs.webkit.org/show_bug.cgi?id=137619
|
if (this.isTemplateElement(node)) {
|
||||||
if (this.isTemplateElement(result) && !this.content(result).childNodes.length &&
|
toImport = this.content(node);
|
||||||
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]));
|
|
||||||
}
|
}
|
||||||
}
|
return document.importNode(toImport, true);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
isPageRule(rule): boolean {
|
isPageRule(rule): boolean {
|
||||||
return rule.type === CSSRule.PAGE_RULE;
|
return rule.type === CSSRule.PAGE_RULE;
|
||||||
|
|
Loading…
Reference in New Issue