fix(browser_adapter): work around WebKit bug with importing template elements
Closes #851 Closes #853
This commit is contained in:
parent
3059104e8d
commit
749a75812c
|
@ -234,7 +234,17 @@ export class BrowserDomAdapter extends DomAdapter {
|
||||||
return node instanceof HTMLElement && isPresent(node.shadowRoot);
|
return node instanceof HTMLElement && isPresent(node.shadowRoot);
|
||||||
}
|
}
|
||||||
importIntoDoc(node:Node) {
|
importIntoDoc(node:Node) {
|
||||||
return document.importNode(node, true);
|
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;
|
||||||
|
for (var i = 0; i < childNodes.length; ++i) {
|
||||||
|
result.content.appendChild(
|
||||||
|
this.importIntoDoc(childNodes[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
isPageRule(rule) {
|
isPageRule(rule) {
|
||||||
return rule.type === CSSRule.PAGE_RULE;
|
return rule.type === CSSRule.PAGE_RULE;
|
||||||
|
|
Loading…
Reference in New Issue