portfolio | contact
May
Thursday the 22th

apply to children

Thursday, 6:10 PM
ok, haven't gotten around to pairing down that javascript mentioned below into the relevant parts. I may or may not at some point. However, while waiting for a project to build (arduous task indeed) I wrote a bit of javascript that takes a node and a function as parameters and recurses through its children, passing each node to the parameter function. I trust you can see the use in that :) heck, maybe you cant. In any case, I made something pretty with it. enjoy. applyToChildren function below:
function applyToChildren(myNode, fn){
fn(myNode);
if(!!myNode.childNodes.length){
for(var i=0;i<myNode.childNodes.length;i++){
applyToChildren(myNode.childNodes[i],fn);
}
}
}

◄ back