MooTools Window Object Dumping
Ever want to see all of the information stored within the window property of your browser? Here's your chance.
The XHTML
<div id="console"></div>
We need a wrapper DIV that we'll consider a console.
The CSS
#console pre { font-family:Courier; font-size:11px; background:#000; color:lightgreen; margin:0 0 20px 0; padding:10px; }
#console h3 { color:navy; padding:3px 0; }
I like making this look like a command-line console.
The MooTools JavaScript
window.addEvent('domready',function() {
new Hash(window).each(function(value,property) {
new Element('h3',{ text: property }).inject('console');
new Element('pre',{ text: value }).inject('console');
});
});
Depending on what you have loaded into the page as a JavaScript framework, the amount stored within the window object will vary.
Fun! You could opt to just log all of this to Firebug's console but the above works in all browsers.
Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...
I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...
The following tools is in its very beta stages and works intermittently. Its so damn useful that I had to show it off now though!
I recently stumbled upon Downloadify, a client-side file generation tool based on JavaScript and Flash ActionScript code. A...
Events play a huge role in JavaScript. I can't name one website I've created in the past two years that hasn't used JavaScript event handling on some level. Ask yourself: how often do I inject elements into the DOM and not add an...
This is really helpful. I find myself doing something similar all the time. But usually I am
console.log
-ingJSON.encode(window)
which does not look very niceHey David, that’s pretty cool, I like it!