Skip to content

Commit

Permalink
fix(dom): in removeClass, check element for null in case of a dispose…
Browse files Browse the repository at this point in the history
…d player (#6701)
  • Loading branch information
travisbader authored and gkatsev committed Jul 15, 2021
1 parent 9ef0c5a commit 2990cc7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/utils/dom.js
Expand Up @@ -282,6 +282,11 @@ export function addClass(element, classToAdd) {
* The DOM element with class name removed.
*/
export function removeClass(element, classToRemove) {
// Protect in case the player gets disposed
if (!element) {
log.warn("removeClass was called with an element that doesn't exist");
return null;
}
if (element.classList) {
element.classList.remove(classToRemove);
} else {
Expand Down

0 comments on commit 2990cc7

Please sign in to comment.