feat(renderer): add a setElementStyles method

This commit is contained in:
Matias Niemelä
2016-04-29 15:18:53 -07:00
parent 982fad0c45
commit 1ac38bd69a
7 changed files with 37 additions and 1 deletions

View File

@ -20,6 +20,8 @@ import {
isString
} from '../../src/facade/lang';
import {StringMapWrapper} from '../../src/facade/collection';
import {BaseException} from '../../src/facade/exceptions';
import {DomSharedStylesHost} from './shared_styles_host';
import {EventManager} from './events/event_manager';
@ -219,6 +221,11 @@ export class DomRenderer implements Renderer {
}
}
setElementStyles(renderElement: any, styles: {[key: string]: string}) {
StringMapWrapper.forEach(styles,
(value, prop) => this.setElementStyle(renderElement, prop, value));
}
setElementStyle(renderElement: any, styleName: string, styleValue: string): void {
if (isPresent(styleValue)) {
getDOM().setStyle(renderElement, styleName, stringify(styleValue));