Skip to content

Instantly share code, notes, and snippets.

@kylebakerio
Last active August 29, 2015 14:25
Show Gist options
  • Save kylebakerio/ff9417323783b8132d11 to your computer and use it in GitHub Desktop.
Save kylebakerio/ff9417323783b8132d11 to your computer and use it in GitHub Desktop.
var getElementsByClassName = function(className){
var output = [];
var childAdd = function(aNode) {
if (_.contains(aNode.classList, className)) {
output.push(aNode)
}
if (aNode.childElementCount > 0) {
_.each(aNode.childNodes, function(val){
childAdd(val)
})
}
}
childAdd(document);
return output;
};
@kylebakerio
Copy link
Author

no longer psuedocode... just dysfunctional code. Pretty sure the idea is sound, though. Just still don't understand html elements in javascript. Now to start experimenting, I guess.

@kylebakerio
Copy link
Author

bam. Wow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment