Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getTree(o){
- var a = [],
- child = o.firstElementChild;
- while(child!=='undefined')
- {
- a.push({
- parent : child,
- childs : (function(){
- if (child.firstElementChild)
- {
- return getTree(child);
- }
- else
- {
- return null;
- }
- })()
- });
- if (child.nextElementSibling)
- {
- child=child.nextElementSibling;
- }
- else
- {
- child='undefined';
- }
- }
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement