text: const CSSCore = {
    addClass(element, className) {
      if (className) {
        if (element.classList) {
          element.classList.add(className);
        } else if (!CSSCore.hasClass(element, className)) {
          element.className = element.className + ' ' + className;
        }
      }
      return element;
    },
  
    removeClass(element, className) {
      if (className) {
        if (element.classList) {
          element.classList.remove(className);
        } else if (CSSCore.hasClass(element, className)) {
          element.className = element.className
            .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
            .replace(/\s+/g, ' ') // multiple spaces to one
            .replace(/^\s*|\s*$/g, ''); // trim the ends
        }
      }
      return element;
    },
  
    hasClass(element, className) {
      if (element.classList) {
        return !!className && element.classList.contains(className);
      }
      return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
    }
  };
  
  export default CSSCore;
  