Created
June 2, 2017 07:00
-
-
Save SigurdMW/fc4500b8184311308541604f3f021c34 to your computer and use it in GitHub Desktop.
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); | |
} | |
} | |
// helper for setting multiple attributes to same element | |
function setAttributes(el, attrs) { | |
for (var key in attrs) { | |
el.setAttribute(key, attrs[key]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment