Gazebo_simulation-Frontend/node_modules/dom-helpers/cjs/removeClass.js
2020-12-21 10:29:31 -05:00

21 lines
685 B
JavaScript

"use strict";
exports.__esModule = true;
exports.default = removeClass;
function replaceClassName(origClass, classToRemove) {
return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
}
function removeClass(element, className) {
if (element.classList) {
element.classList.remove(className);
} else if (typeof element.className === 'string') {
;
element.className = replaceClassName(element.className, className);
} else {
element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
}
}
module.exports = exports["default"];