hasClass.js 253 Bytes
Newer Older
Sangjune Bae's avatar
Sangjune Bae committed
1
2
3
4
export default function hasClass(element, className) {
  if (element.classList) return !!className && element.classList.contains(className);
  return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
}