mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
17 lines
474 B
JavaScript
17 lines
474 B
JavaScript
|
"use strict";
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
exports.default = hasClass;
|
||
|
|
||
|
/**
|
||
|
* Checks if a given element has a CSS class.
|
||
|
*
|
||
|
* @param element the element
|
||
|
* @param className the CSS class name
|
||
|
*/
|
||
|
function hasClass(element, className) {
|
||
|
if (element.classList) return !!className && element.classList.contains(className);
|
||
|
return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
||
|
}
|
||
|
|
||
|
module.exports = exports["default"];
|