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

4 lines
398 B
JavaScript

import hasClass from './hasClass';
export default function addClass(element, className) {
if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
}