From b7b56785d19c5975e2ba35033e526c05081112a6 Mon Sep 17 00:00:00 2001 From: Matt Wheatley Date: Thu, 26 May 2016 14:41:33 +0100 Subject: [PATCH] fix(Renderer): update signatures to make RenderDebugInfo optional The code does not force the user to provider `RenderDebugInfo`. The current implementation lists this as a mandatory parameter. Update the parameter to be optional. Fixes #8466 Closes #8859 --- modules/@angular/core/src/debug/debug_renderer.ts | 10 +++++----- modules/@angular/core/src/render/api.ts | 10 +++++----- .../src/web_workers/worker/renderer.ts | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/@angular/core/src/debug/debug_renderer.ts b/modules/@angular/core/src/debug/debug_renderer.ts index 5184f74eca..43df05bc29 100644 --- a/modules/@angular/core/src/debug/debug_renderer.ts +++ b/modules/@angular/core/src/debug/debug_renderer.ts @@ -24,14 +24,14 @@ export class DebugDomRootRenderer implements RootRenderer { export class DebugDomRenderer implements Renderer { constructor(private _delegate: Renderer) {} - selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): any { + selectRootElement(selectorOrNode: string | any, debugInfo?: RenderDebugInfo): any { var nativeEl = this._delegate.selectRootElement(selectorOrNode, debugInfo); var debugEl = new DebugElement(nativeEl, null, debugInfo); indexDebugNode(debugEl); return nativeEl; } - createElement(parentElement: any, name: string, debugInfo: RenderDebugInfo): any { + createElement(parentElement: any, name: string, debugInfo?: RenderDebugInfo): any { var nativeEl = this._delegate.createElement(parentElement, name, debugInfo); var debugEl = new DebugElement(nativeEl, getDebugNode(parentElement), debugInfo); debugEl.name = name; @@ -41,14 +41,14 @@ export class DebugDomRenderer implements Renderer { createViewRoot(hostElement: any): any { return this._delegate.createViewRoot(hostElement); } - createTemplateAnchor(parentElement: any, debugInfo: RenderDebugInfo): any { + createTemplateAnchor(parentElement: any, debugInfo?: RenderDebugInfo): any { var comment = this._delegate.createTemplateAnchor(parentElement, debugInfo); var debugEl = new DebugNode(comment, getDebugNode(parentElement), debugInfo); indexDebugNode(debugEl); return comment; } - createText(parentElement: any, value: string, debugInfo: RenderDebugInfo): any { + createText(parentElement: any, value: string, debugInfo?: RenderDebugInfo): any { var text = this._delegate.createText(parentElement, value, debugInfo); var debugEl = new DebugNode(text, getDebugNode(parentElement), debugInfo); indexDebugNode(debugEl); @@ -136,7 +136,7 @@ export class DebugDomRenderer implements Renderer { this._delegate.setElementStyle(renderElement, styleName, styleValue); } - invokeElementMethod(renderElement: any, methodName: string, args: any[]) { + invokeElementMethod(renderElement: any, methodName: string, args?: any[]) { this._delegate.invokeElementMethod(renderElement, methodName, args); } diff --git a/modules/@angular/core/src/render/api.ts b/modules/@angular/core/src/render/api.ts index f52411ca87..8ed2f106c3 100644 --- a/modules/@angular/core/src/render/api.ts +++ b/modules/@angular/core/src/render/api.ts @@ -26,15 +26,15 @@ export abstract class RenderDebugInfo { * @experimental */ export abstract class Renderer { - abstract selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): any; + abstract selectRootElement(selectorOrNode: string | any, debugInfo?: RenderDebugInfo): any; - abstract createElement(parentElement: any, name: string, debugInfo: RenderDebugInfo): any; + abstract createElement(parentElement: any, name: string, debugInfo?: RenderDebugInfo): any; abstract createViewRoot(hostElement: any): any; - abstract createTemplateAnchor(parentElement: any, debugInfo: RenderDebugInfo): any; + abstract createTemplateAnchor(parentElement: any, debugInfo?: RenderDebugInfo): any; - abstract createText(parentElement: any, value: string, debugInfo: RenderDebugInfo): any; + abstract createText(parentElement: any, value: string, debugInfo?: RenderDebugInfo): any; abstract projectNodes(parentElement: any, nodes: any[]): void; @@ -65,7 +65,7 @@ export abstract class Renderer { abstract setElementStyle(renderElement: any, styleName: string, styleValue: string); - abstract invokeElementMethod(renderElement: any, methodName: string, args: any[]); + abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]); abstract setText(renderNode: any, text: string); diff --git a/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts b/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts index 2fe91dc3fc..36eed29b11 100644 --- a/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts +++ b/modules/@angular/platform-browser/src/web_workers/worker/renderer.ts @@ -92,14 +92,14 @@ export class WebWorkerRenderer implements Renderer, RenderStoreObject { this._rootRenderer.runOnService(fnName, fnArgsWithRenderer); } - selectRootElement(selectorOrNode: string, debugInfo: RenderDebugInfo): any { + selectRootElement(selectorOrNode: string, debugInfo?: RenderDebugInfo): any { var node = this._rootRenderer.allocateNode(); this._runOnService('selectRootElement', [new FnArg(selectorOrNode, null), new FnArg(node, RenderStoreObject)]); return node; } - createElement(parentElement: any, name: string, debugInfo: RenderDebugInfo): any { + createElement(parentElement: any, name: string, debugInfo?: RenderDebugInfo): any { var node = this._rootRenderer.allocateNode(); this._runOnService('createElement', [ new FnArg(parentElement, RenderStoreObject), @@ -119,7 +119,7 @@ export class WebWorkerRenderer implements Renderer, RenderStoreObject { return viewRoot; } - createTemplateAnchor(parentElement: any, debugInfo: RenderDebugInfo): any { + createTemplateAnchor(parentElement: any, debugInfo?: RenderDebugInfo): any { var node = this._rootRenderer.allocateNode(); this._runOnService( 'createTemplateAnchor', @@ -127,7 +127,7 @@ export class WebWorkerRenderer implements Renderer, RenderStoreObject { return node; } - createText(parentElement: any, value: string, debugInfo: RenderDebugInfo): any { + createText(parentElement: any, value: string, debugInfo?: RenderDebugInfo): any { var node = this._rootRenderer.allocateNode(); this._runOnService('createText', [ new FnArg(parentElement, RenderStoreObject), @@ -205,7 +205,7 @@ export class WebWorkerRenderer implements Renderer, RenderStoreObject { ]); } - invokeElementMethod(renderElement: any, methodName: string, args: any[]) { + invokeElementMethod(renderElement: any, methodName: string, args?: any[]) { this._runOnService('invokeElementMethod', [ new FnArg(renderElement, RenderStoreObject), new FnArg(methodName, null),