Skip to content

Instantly share code, notes, and snippets.

@yamitake
Created June 28, 2012 16:12
Show Gist options
  • Select an option

  • Save yamitake/3012225 to your computer and use it in GitHub Desktop.

Select an option

Save yamitake/3012225 to your computer and use it in GitHub Desktop.
lessquelton prototype
var result = {};
function dive(elem , arr){
if(!arr)arr = {};
arr[elem.get(0).tagName.toLowerCase()] = {}
elem.children().each(function(){
dive($(this) , arr[elem.get(0).tagName.toLowerCase()]);
});
return arr;
}
function indent(depth){
var tab = "";
for(var i = 0; i < depth; i++){
tab += " ";
}
return tab;
}
var aaa = dive($("header"));//要素を指定
aaa;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment