Mercurial > hg > digilib-old
changeset 414:68c26335e880
added debugProps() method for viewing an object's properties
author | hertzhaft |
---|---|
date | Tue, 20 Dec 2005 17:32:22 +0100 |
parents | 0475c9a416e7 |
children | de7200c3a3e2 |
files | client/digitallibrary/greyskin/debug.js |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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());