Skip to content

Commit

Permalink
feat(core): fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
robwormald committed Jul 12, 2018
1 parent 525ca3e commit 7a08d69
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions packages/platform-browser/src/dom/dom_renderer.ts
Expand Up @@ -141,10 +141,9 @@ class DefaultDomRenderer2 implements Renderer2 {
if (!el) {
throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
}
if (preserveContent) {
return el;
if (!preserveContent) {
el.textContent = '';
}
el.textContent = ''
return el;
}

Expand Down Expand Up @@ -274,20 +273,6 @@ class ShadowDomRenderer extends DefaultDomRenderer2 {
}
}

selectRootElement(selectorOrNode: string|any): any {
let el: any = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
selectorOrNode;
if (!el) {
throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
}
// do not clear the existing element content when using ShadowDOM, to allow <slot> elements to
// work.
if (this.component.encapsulation !== ViewEncapsulation.ShadowDom) {
el.textContent = '';
}
return el;
}

private nodeOrShadowRoot(node: any): any { return node === this.hostEl ? this.shadowRoot : node; }

destroy() { this.sharedStylesHost.removeHost(this.shadowRoot); }
Expand Down

0 comments on commit 7a08d69

Please sign in to comment.