Logo
doctype [?]
[strict] [loose] [none]

Data Dumper


Class Methods

Dumper (object [,property]* ) : String

Traverse the object and return a string representation.

ArgumentTypeRequiredDescription
objectObjectyesThe object to be inspected
propertyStringnoAny number of string property names may be passed as the 2nd...nth arguments. If they exist, then only the properties of 'object' with these names will be traversed and shown in the output.

Returns: String

Dumper.write (object [,document [,property]*]) : void

Get the contents of the Dumper(object) call and call document.write() to write it to the page.

ArgumentTypeRequiredDescription
objectObjectyesThe object to be inspected
documentDocumentnoOptionally, a document object to write to other than the current window.document object. This allows you to write to an iframe or popup window, for example.
propertyStringnoAny number of string property names may be passed as the 2nd...nth arguments. If they exist, then only the properties of 'object' with these names will be traversed and shown in the output.

Returns: void

Dumper.alert (object [,property]*) : void

Get the contents of the Dumper(object) call and show it in an alert() box.

ArgumentTypeRequiredDescription
objectObjectyesThe object to be inspected
propertyStringnoAny number of string property names may be passed as the 2nd...nth arguments. If they exist, then only the properties of 'object' with these names will be traversed and shown in the output.

Returns: void

Dumper.popup (object [,property]*) : void

Get the contents of the Dumper(object) call pop up a new window to display the contents.

ArgumentTypeRequiredDescription
objectObjectyesThe object to be inspected
propertyStringnoAny number of string property names may be passed as the 2nd...nth arguments. If they exist, then only the properties of 'object' with these names will be traversed and shown in the output.

Returns: void

Dumper.setMaxIterations (number) : void

Set the max number of properties to be traversed. Defaults to 1,000. This is to prevent circular data structures from recursively following properties forever, causing the browser to lock up.

ArgumentTypeRequiredDescription
numberIntyesThe number of properties

Returns: void

Dumper.setMaxDepth (number) : void

The maximum depth that will be inspected from the root object. This differs from maxIterations in that it doesn't restrict how many total properties to inspect, but rather how deeply within the tree to inspect.

ArgumentTypeRequiredDescription
numberIntyesThe depth to traverse

Returns: void

Notes

DOM Objects

Since DOM objects (elements, etc) have circular references and often many properties, when DataDumper hits these objects it takes special action. If it hits the window object itself, it returns "[window]". If it hits the document object, it returns "[document]". For other tags, it only returns the elements' tagName, nodeName, nodeType, id, and className properties.