4 lines
253 B
JavaScript
4 lines
253 B
JavaScript
export default function hasClass(element, className) {
|
|
if (element.classList) return !!className && element.classList.contains(className);
|
|
return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
|
} |