Continuied from json back reference.
I just want to travarse a hierarchy and set a property parent
to its parent node. so that its both way travarsable
function attach_back_reference(hierarchy, parent){
for(var i in hierarchy){
if(jQuery.isPlainObject(hierarchy[i]))
attach_back_reference(hierarchy[i], hierarchy);
else if(jQuery.isArray(hierarchy[i]))
for(var it in hierarchy[i])
attach_back_reference(hierarchy[i][it], hierarchy);
}
hierarchy.parent = parent;
}
The above function works well in chrome, opera, firefox, IE9 . except IE 8 where it says Out of stack space. But I don't see anywhere it goes towards infinite recursion