If I do:
var el =
{
o : document.createElement(\"iframe\")
}
var fs = JSON.stringify(el);
and then I try to access with
var ofs = JSON.parse(fs);
function elementToObject(element) {
var el = $(element)[0];
var o = {tagName: el.tagName};
_.each(el.attributes, function(attribute){o[attribute.name] = attribute.value;});
o["children"]=_.map($(el).children(), function(child){return elementToObject(child)});
return o;
}
This is working with jquery 3.1.0 and underscore.js.