Created
May 29, 2017 08:08
-
-
Save SigurdMW/160990e8ed8cd5d6cded0779f50ad6b5 to your computer and use it in GitHub Desktop.
helpers to avoid using jquery. Focus on browser compat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// classlist helper for better browser compat | |
var hasClass = function(el, className){ | |
if (el.classList){ | |
return el.classList.contains(className); | |
} else { | |
return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment