Skip to content

Commit

Permalink
fix(BrowserAdapter): correctly removes styles on IE
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Sep 30, 2016
1 parent 2f673e1 commit 37e11af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/@angular/common/src/directives/ng_style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class NgStyle implements DoCheck {

private _setStyle(nameAndUnit: string, value: string): void {
const [name, unit] = nameAndUnit.split('.');
value = value !== null && value !== void(0) && unit ? `${value}${unit}` : value;
value = value && unit ? `${value}${unit}` : value;

this._renderer.setElementStyle(this._ngEl.nativeElement, name, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
setStyle(element: any, styleName: string, styleValue: string) {
element.style[styleName] = styleValue;
}
removeStyle(element: any, stylename: string) { element.style[stylename] = null; }
removeStyle(element: any, stylename: string) {
// IE requires '' instead of null
// see https://github.com/angular/angular/issues/7916
element.style[stylename] = '';
}
getStyle(element: any, stylename: string): string { return element.style[stylename]; }
hasStyle(element: any, styleName: string, styleValue: string = null): boolean {
const value = this.getStyle(element, styleName) || '';
Expand Down

0 comments on commit 37e11af

Please sign in to comment.