Created
January 19, 2017 07:29
-
-
Save VoloshchenkoAl/c159ebdf849d5ce3d9592736d9f917aa to your computer and use it in GitHub Desktop.
This file contains 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
_workWithDOM:{ | |
_empty: function( parent ) { | |
while (parent.firstChild) { | |
parent.removeChild(parent.firstChild); | |
} | |
}, | |
_removeClass: function( el, className ) { | |
if( el.classList ) { | |
el.classList.remove( className ); | |
} else { | |
var classes = el.className.split(" "); | |
classes.splice(classes.indexOf(className), 1); | |
el.className = classes.join(' '); | |
} | |
}, | |
_addClass: function( el, className ) { | |
if( el.classList ) { | |
el.classList.add( className ); | |
} else { | |
var classes = el.className.split(" "); | |
el.className = classes.concat( className ).join(' '); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment