refactor(core): remove shadow dom utility from DomAdapters (#32278)

PR Close #32278
This commit is contained in:
Kara Erickson
2019-08-22 18:26:01 -07:00
committed by atscott
parent 24127a2492
commit 28c8b03797
7 changed files with 24 additions and 33 deletions

View File

@ -16,6 +16,8 @@ import {isCommentNode} from '@angular/platform-browser/testing/src/browser_util'
/**
* Jasmine matchers that check Angular specific conditions.
*
* Note: These matchers will only work in a browser environment.
*/
export interface NgMatchers<T = any> extends jasmine.Matchers<T> {
/**
@ -294,8 +296,8 @@ function elementText(n: any): string {
return elementText(Array.prototype.slice.apply(getDOM().getDistributedNodes(n)));
}
if (getDOM().hasShadowRoot(n)) {
return elementText(getDOM().childNodesAsList(getDOM().getShadowRoot(n)));
if (hasShadowRoot(n)) {
return elementText(getDOM().childNodesAsList((<any>n).shadowRoot));
}
if (hasNodes(n)) {
@ -304,3 +306,7 @@ function elementText(n: any): string {
return getDOM().getText(n) !;
}
function hasShadowRoot(node: any): boolean {
return node.shadowRoot != null && node instanceof HTMLElement;
}