1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-17 21:18:27 +02:00

fix(dom): in removeClass, check element for null in case of a disposed player (#6701)

This commit is contained in:
Travis Bader 2021-07-15 08:14:03 -07:00 committed by Gary Katsevman
parent 9ef0c5ac44
commit 2990cc7d65

View File

@ -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 {