Skip to content

Instantly share code, notes, and snippets.

@wteuber
Created May 2, 2013 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wteuber/5500816 to your computer and use it in GitHub Desktop.
Save wteuber/5500816 to your computer and use it in GitHub Desktop.
== inspect for IE8 == For quick debugging in IE8's developer tools usage: inspect(window)
/*
because IE8 doesn't support Object.keys...
*/
Object.keys = Object.keys || function(o) {
var result = [];
for(var name in o) {
if (Object.prototype.hasOwnProperty.call(o,name)) {
result.push(name);
}
}
return result;
};
/*
use inspect(your_var);
*/
function inspect (obj) {
var i, prop = [], o = Object.keys(obj).sort();
for (i in o) {
prop.push("[" + typeof (obj[o[i]]) + "] " + o[i]);
}
console.log("\n" + prop.join("\n"));
}
inspect(window)
/* (trail on google.com)
standard output
>>window
{...}
ie8_debug output
>>inspect(window)
LOG:
[object] _
[string] __PVT
[object] ___jsl
[object] clientInformation
[object] clipboardData
[boolean] closed
[object] console
[string] defaultStatus
[object] document
[object] event
[object] external
[object] frameElement
[object] frames
[object] gapi
[object] gbar
[object] google
[object] history
[number] length
[object] localStorage
[object] location
[function] lol
[number] maxConnectionsPerServer
[string] name
[object] navigator
[string] offscreenBuffering
[object] onafterprint
[object] onbeforeprint
[object] onbeforeunload
[object] onblur
[object] onerror
[object] onfocus
[object] onhashchange
[object] onhelp
[function] onload
[object] onmessage
[function] onpopstate
[object] onresize
[object] onscroll
[object] onunload
[undefined] opener
[object] parent
[function] rwt
[object] screen
[number] screenLeft
[number] screenTop
[object] self
[object] sessionStorage
[string] status
[object] top
[object] wgjf
[object] window
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment