+ function toDOMNode(object)
+ {
+ var output = document.createElement('dl');
+
+ for (property in object) {
+ var value = object[property];
+ if (typeof(value) == 'function')
+ continue;
+ var div = document.createElement('div');
+ var dt = document.createElement('dt');
+ dt.innerText = property;
+
+ var dd = document.createElement('dd');
+ if (value instanceof Atom)
+ dd.appendChild(toDOMNode(value));
+ else if (value instanceof Array) {
+ dd.appendChild(toDOMNode(value));
+ }
+ else if (typeof(value) == "string")
+ dd.innerText = '"' + value + '"';
+ else if (value instanceof Date)
+ dd.innerText = value.toLocaleString();
+ else
+ dd.innerText = value;
+
+ div.appendChild(dt);
+ div.appendChild(dd);
+ output.appendChild(div);
+ }
+ return output;
+ }
+