refactor(core): remove shadow dom utility from DomAdapters (#32278)
PR Close #32278
This commit is contained in:
@ -198,8 +198,6 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||
doc = doc || this.getDefaultDocument();
|
||||
return doc.createTextNode(text);
|
||||
}
|
||||
createShadowRoot(el: HTMLElement): DocumentFragment { return (<any>el).createShadowRoot(); }
|
||||
getShadowRoot(el: HTMLElement): DocumentFragment { return (<any>el).shadowRoot; }
|
||||
getHost(el: HTMLElement): HTMLElement { return (<any>el).host; }
|
||||
clone(node: Node): Node { return node.cloneNode(true); }
|
||||
getElementsByTagName(element: any, name: string): HTMLElement[] {
|
||||
@ -261,11 +259,8 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||
}
|
||||
isTextNode(node: Node): boolean { return node.nodeType === Node.TEXT_NODE; }
|
||||
isElementNode(node: Node): boolean { return node.nodeType === Node.ELEMENT_NODE; }
|
||||
hasShadowRoot(node: any): boolean {
|
||||
return node.shadowRoot != null && node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
isShadowRoot(node: any): boolean { return node instanceof DocumentFragment; }
|
||||
getHref(el: Element): string { return el.getAttribute('href') !; }
|
||||
|
||||
getEventKey(event: any): string {
|
||||
let key = event.key;
|
||||
|
@ -21,7 +21,4 @@ export abstract class GenericBrowserDomAdapter extends DomAdapter {
|
||||
|
||||
getDistributedNodes(el: HTMLElement): Node[] { return (<any>el).getDistributedNodes(); }
|
||||
supportsDOMEvents(): boolean { return true; }
|
||||
supportsNativeShadowDOM(): boolean {
|
||||
return typeof(<any>document.body).createShadowRoot === 'function';
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,6 @@ export abstract class DomAdapter {
|
||||
abstract createElement(tagName: any, doc?: any): HTMLElement;
|
||||
abstract createElementNS(ns: string, tagName: string, doc?: any): Element;
|
||||
abstract createTextNode(text: string, doc?: any): Text;
|
||||
abstract createShadowRoot(el: any): any;
|
||||
abstract getShadowRoot(el: any): any;
|
||||
abstract getHost(el: any): any;
|
||||
abstract getDistributedNodes(el: any): Node[];
|
||||
abstract clone /*<T extends Node>*/ (node: Node /*T*/): Node /*T*/;
|
||||
@ -107,13 +105,18 @@ export abstract class DomAdapter {
|
||||
abstract isTemplateElement(el: any): boolean;
|
||||
abstract isTextNode(node: any): boolean;
|
||||
abstract isElementNode(node: any): boolean;
|
||||
abstract hasShadowRoot(node: any): boolean;
|
||||
|
||||
// Used by Testability
|
||||
abstract isShadowRoot(node: any): boolean;
|
||||
abstract getHref(element: any): string;
|
||||
|
||||
// Used by KeyEventsPlugin
|
||||
abstract getEventKey(event: any): string;
|
||||
abstract supportsDOMEvents(): boolean;
|
||||
abstract supportsNativeShadowDOM(): boolean;
|
||||
|
||||
// Used by PlatformLocation and ServerEventManagerPlugin
|
||||
abstract getGlobalEventTarget(doc: Document, target: string): any;
|
||||
|
||||
// Used by PlatformLocation
|
||||
abstract getHistory(): History;
|
||||
abstract getLocation(): Location;
|
||||
abstract getBaseHref(doc: Document): string|null;
|
||||
|
Reference in New Issue
Block a user