diff --git a/packages/core/test/linker/integration_spec.ts b/packages/core/test/linker/integration_spec.ts index c74ef9424d..e5b6dab56b 100644 --- a/packages/core/test/linker/integration_spec.ts +++ b/packages/core/test/linker/integration_spec.ts @@ -1494,8 +1494,7 @@ function declareTests(config?: {useJit: boolean}) { expect(noSelectorComponentFactory.selector).toBe('ng-component'); expect( - getDOM() - .nodeName(noSelectorComponentFactory.create(Injector.NULL).location.nativeElement) + noSelectorComponentFactory.create(Injector.NULL).location.nativeElement.nodeName .toLowerCase()) .toEqual('ng-component'); }); @@ -1534,7 +1533,7 @@ function declareTests(config?: {useJit: boolean}) { throw 'Should throw'; } catch (e) { const c = getDebugContext(e); - expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual('DIV'); + expect(c.componentRenderElement.nodeName.toUpperCase()).toEqual('DIV'); expect((c.injector).get).toBeTruthy(); } }); @@ -1550,8 +1549,8 @@ function declareTests(config?: {useJit: boolean}) { throw 'Should throw'; } catch (e) { const c = getDebugContext(e); - expect(getDOM().nodeName(c.renderNode).toUpperCase()).toEqual('INPUT'); - expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual('DIV'); + expect(c.renderNode.nodeName.toUpperCase()).toEqual('INPUT'); + expect(c.componentRenderElement.nodeName.toUpperCase()).toEqual('DIV'); expect((c.injector).get).toBeTruthy(); expect(c.context).toEqual(fixture.componentInstance); expect(c.references['local']).toBeDefined(); @@ -1595,8 +1594,8 @@ function declareTests(config?: {useJit: boolean}) { expect(err).toBeTruthy(); const c = getDebugContext(err); - expect(getDOM().nodeName(c.renderNode).toUpperCase()).toEqual('SPAN'); - expect(getDOM().nodeName(c.componentRenderElement).toUpperCase()).toEqual('DIV'); + expect(c.renderNode.nodeName.toUpperCase()).toEqual('SPAN'); + expect(c.componentRenderElement.nodeName.toUpperCase()).toEqual('DIV'); expect((c.injector).get).toBeTruthy(); expect(c.context).toEqual(fixture.componentInstance); expect(c.references['local']).toBeDefined(); diff --git a/packages/core/test/view/component_view_spec.ts b/packages/core/test/view/component_view_spec.ts index f2c51a69eb..b1091b980f 100644 --- a/packages/core/test/view/component_view_spec.ts +++ b/packages/core/test/view/component_view_spec.ts @@ -43,7 +43,7 @@ const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener' expect(compView.component).toBe(instance); const compRootEl = rootNodes[0].childNodes[0]; - expect(getDOM().nodeName(compRootEl).toLowerCase()).toBe('span'); + expect(compRootEl.nodeName.toLowerCase()).toBe('span'); }); if (isBrowser()) { diff --git a/packages/core/test/view/element_spec.ts b/packages/core/test/view/element_spec.ts index 3d24fb5b3a..f6e37b963a 100644 --- a/packages/core/test/view/element_spec.ts +++ b/packages/core/test/view/element_spec.ts @@ -32,7 +32,7 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent elementDef(0, NodeFlags.None, null, null, 0, 'span') ])).rootNodes; expect(rootNodes.length).toBe(1); - expect(getDOM().nodeName(rootNodes[0]).toLowerCase()).toBe('span'); + expect(rootNodes[0].nodeName.toLowerCase()).toBe('span'); }); it('should create views with multiple root elements', () => { @@ -50,7 +50,7 @@ const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEvent ])).rootNodes; expect(rootNodes.length).toBe(1); const spanEl = rootNodes[0].childNodes[0]; - expect(getDOM().nodeName(spanEl).toLowerCase()).toBe('span'); + expect(spanEl.nodeName.toLowerCase()).toBe('span'); }); it('should set fixed attributes', () => { diff --git a/packages/platform-browser/src/browser/browser_adapter.ts b/packages/platform-browser/src/browser/browser_adapter.ts index b6abdafd41..29eba32db0 100644 --- a/packages/platform-browser/src/browser/browser_adapter.ts +++ b/packages/platform-browser/src/browser/browser_adapter.ts @@ -80,7 +80,6 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { hasProperty(element: Node, name: string): boolean { return name in element; } setProperty(el: Node, name: string, value: any) { (el)[name] = value; } getProperty(el: Node, name: string): any { return (el)[name]; } - invoke(el: Node, methodName: string, args: any[]): any { (el)[methodName](...args); } // TODO(tbosch): move this into a separate environment class once we have it logError(error: string): void { @@ -139,9 +138,6 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { isPrevented(evt: Event): boolean { return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue; } - nodeName(node: Node): string { return node.nodeName; } - nodeValue(node: Node): string|null { return node.nodeValue; } - type(node: HTMLInputElement): string { return node.type; } nextSibling(el: Node): Node|null { return el.nextSibling; } parentElement(el: Node): Node|null { return el.parentNode; } clearNodes(el: Node) { diff --git a/packages/platform-browser/src/dom/dom_adapter.ts b/packages/platform-browser/src/dom/dom_adapter.ts index 7902c7eb23..2303f684e8 100644 --- a/packages/platform-browser/src/dom/dom_adapter.ts +++ b/packages/platform-browser/src/dom/dom_adapter.ts @@ -35,7 +35,6 @@ export abstract class DomAdapter { abstract hasProperty(element: any, name: string): boolean; abstract setProperty(el: Element, name: string, value: any): any; abstract getProperty(el: Element, name: string): any; - abstract invoke(el: Element, methodName: string, args: any[]): any; abstract logError(error: any): any; abstract log(error: any): any; @@ -53,17 +52,14 @@ export abstract class DomAdapter { abstract createEvent(eventType: string): any; abstract preventDefault(evt: any): any; abstract isPrevented(evt: any): boolean; - abstract nodeName(node: any): string; - abstract nodeValue(node: any): string|null; - abstract type(node: any): string; - abstract nextSibling(el: any): Node|null; - abstract parentElement(el: any): Node|null; // Used by Meta abstract remove(el: any): Node; abstract getAttribute(element: any, attribute: string): string|null; // Used by platform-server + abstract nextSibling(el: any): Node|null; + abstract parentElement(el: any): Node|null; abstract clearNodes(el: any): any; abstract appendChild(el: any, node: any): any; abstract removeChild(el: any, node: any): any; diff --git a/packages/platform-webworker/src/web_workers/worker/worker_adapter.ts b/packages/platform-webworker/src/web_workers/worker/worker_adapter.ts index 482ac00bf6..3a54ce5a7a 100644 --- a/packages/platform-webworker/src/web_workers/worker/worker_adapter.ts +++ b/packages/platform-webworker/src/web_workers/worker/worker_adapter.ts @@ -50,7 +50,6 @@ export class WorkerDomAdapter extends DomAdapter { hasProperty(element: any, name: string): boolean { throw 'not implemented'; } setProperty(el: Element, name: string, value: any) { throw 'not implemented'; } getProperty(el: Element, name: string): any { throw 'not implemented'; } - invoke(el: Element, methodName: string, args: any[]): any { throw 'not implemented'; } parse(templateHtml: string) { throw 'not implemented'; } querySelector(el: any, selector: string): HTMLElement { throw 'not implemented'; } @@ -62,9 +61,6 @@ export class WorkerDomAdapter extends DomAdapter { createEvent(eventType: string): any { throw 'not implemented'; } preventDefault(evt: any) { throw 'not implemented'; } isPrevented(evt: any): boolean { throw 'not implemented'; } - nodeName(node: any): string { throw 'not implemented'; } - nodeValue(node: any): string { throw 'not implemented'; } - type(node: any): string { throw 'not implemented'; } nextSibling(el: any): Node { throw 'not implemented'; } parentElement(el: any): Node { throw 'not implemented'; } clearNodes(el: any) { throw 'not implemented'; }