Object.prototype.list (Firefox only)

Object.prototype.__defineGetter__('list', function (dep) {
var r   = [];
var ind = '';
var dep = (typeof(dep) == 'number') ? ++dep : 0;

for (var i = 0; i < dep; i++) { ind += '	'; }
for (var i in this) {
if (this.hasOwnProperty(i)) {
var is_obj = (typeof(this[i]) == 'object');

r.push(ind + i + ': ');
r.push(is_obj ? '' : this[i]);
r.push('
');
r.push(is_obj ? arguments.callee.apply(this[i], [dep]) : '');
}
}

return r.join('');
});

source

Leave a Reply