fix(renderer): remove unecessary setElementStyles method

There is no need to expose this additional method inside of the Renderer
API. The functionality can be restored by looping and calling
`setElementStyle` instead.

Note that this change is changing code that was was introduced after
the last release therefore this fix is not a breaking change.

Closes #9000
Closes #9009
This commit is contained in:
Matias Niemelä
2016-06-03 14:59:42 -07:00
parent a6ad61d83e
commit e504d4eb05
12 changed files with 22 additions and 43 deletions

View File

@ -101,6 +101,12 @@ export function collectAndResolveStyles(collection: {[key: string]: string|numbe
});
}
export function renderStyles(element: any, renderer: any, styles: {[key: string]: string|number}): void {
StringMapWrapper.forEach(styles, (value, prop) => {
renderer.setElementStyle(element, prop, value);
});
}
export function flattenStyles(styles: {[key: string]: string|number}[]) {
var finalStyles = {};
styles.forEach(entry => {

View File

@ -134,17 +134,6 @@ export class DebugDomRenderer implements Renderer {
this._delegate.setElementClass(renderElement, className, isAdd);
}
setElementStyles(renderElement: any, styles: {[key: string]: string}) {
var debugEl = getDebugNode(renderElement);
if (isPresent(debugEl) && debugEl instanceof DebugElement) {
var elStyles = debugEl.styles;
StringMapWrapper.forEach(styles, (value, prop) => {
elStyles[prop] = value;
});
}
this._delegate.setElementStyles(renderElement, styles);
}
setElementStyle(renderElement: any, styleName: string, styleValue: string) {
var debugEl = getDebugNode(renderElement);
if (isPresent(debugEl) && debugEl instanceof DebugElement) {

View File

@ -61,8 +61,6 @@ export abstract class Renderer {
abstract setElementClass(renderElement: any, className: string, isAdd: boolean);
abstract setElementStyles(renderElement: any, styles: {[key: string]: string});
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string);
abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]);