In javascript, you can find the current element class name by calling
element.getClassName();
In at least current versions of firefox and chrome, you can find directly applicable styles with
element.getAttribute("style");
This will include software applied positions, for example. at http://jqueryui.com/demos/draggable/ you can do
document.getElementById('draggable').getAttribute("style"); "position: relative; "
and after dragging the draggable object, if you do it again, you will get the current position:
document.getElementById('draggable').getAttribute("style"); "position: relative; left: 63px; top: 39px; "
You can get the contents of an element using element.innerHTML. This, plus the style plus the class name, is likely to be sufficient to properly serialize the element. If you want to serialize a complete tree of complex components, this will be a slightly more complex process - innerHTML will only work for relatively simple elements.
source share