# HG changeset patch # User hertzhaft # Date 1135096342 -3600 # Node ID 68c26335e880ca0b95f8ad140bde9856e6cabc3e # Parent 0475c9a416e71cbe8718ec4f64dfb4c713ce269d added debugProps() method for viewing an object's properties diff -r 0475c9a416e7 -r 68c26335e880 client/digitallibrary/greyskin/debug.js --- a/client/digitallibrary/greyskin/debug.js Tue Dec 20 17:31:28 2005 +0100 +++ b/client/digitallibrary/greyskin/debug.js Tue Dec 20 17:32:22 2005 +0100 @@ -47,14 +47,28 @@ return appendNewElement(D, "p", msg); } -function debugObject(obj) { +function debugProps(obj, msg) { + var D = getDebug(); + if (msg) appendNewElement(D, "h1", msg); + for (var item in obj) { + var typ = typeof(obj[item]); + if (typ != "function") appendNewElement(D, "p", + item + + " (" + typ + "): " + + obj[item] + ); + }; + } + +function debugObject(obj, msg) { + if (msg) appendNewElement(D, "h1", msg); var D = getDebug(); var A = new Array(); for (var i in obj) A[i] = typeof(obj[i]); var T = appendNewElement(D, "table"); for (var item in A) { var TR = appendNewElement(T, "tr"); - appendNewElement(TR, "td", element("b", item)); + appendNewElement(TR, "td", newElement("b", item)); appendNewElement(TR, "td", A[item]); if (A[item] == "function") appendNewElement(TR, "td", A[item].toSource());