Skip to content

Commit

Permalink
fix #26021
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 5, 2017
1 parent e66892f commit 688b96f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/vs/base/browser/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,25 @@ const _manualClassList = new class {

const _nativeClassList = new class {
hasClass(node: HTMLElement, className: string): boolean {
return className && node.classList.contains(className);
return className && node.classList && node.classList.contains(className);
}

addClass(node: HTMLElement, className: string): void {
return className && node.classList.add(className);
if (className && node.classList) {
node.classList.add(className);
}
}

removeClass(node: HTMLElement, className: string): void {
return className && node.classList.remove(className);
if (className && node.classList) {
node.classList.remove(className);
}
}

toggleClass(node: HTMLElement, className: string, shouldHaveIt?: boolean): void {
node.classList.toggle(className, shouldHaveIt);
if (node.classList) {
node.classList.toggle(className, shouldHaveIt);
}
}
};

Expand Down

0 comments on commit 688b96f

Please sign in to comment.