Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created September 27, 2013 17:30
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulirish/6732048 to your computer and use it in GitHub Desktop.
Save paulirish/6732048 to your computer and use it in GitHub Desktop.
Con$ole Bling

Con$ole Bling

Before I get into this, I should point out that if you have jQuery on your page, when you type $ in your console it's indeed jQuery, otherwise, it's defined by your developer tools.

History

A bit ago, someone on SO asked where does $$() come from? Alex Russell called this "the bling-bling function", and it's part of the Command Line API and will return an array of elements to match a CSS selector. Why the double $$? Well, the single $ was already taken: the pioneer of developer tools, Firebug, assigned the $() to getElementById and so it has remained.

But.. let's be real though, ID's? Who is using ID's anymore? Using $ and $$ I often thought they were holding onto the JavaScript standards of 2006, so it needed updating. Let's bring it into today.

Cross-browser devtool collaboration

Addy Osmani felt similarly so we jumped into freenode IRC and had a chat with the developers behind both Firefox Web Developer Tools and Firebug with the goal of getting this function representing querySelector instead of tis legacy baggage of $ meaning gEByID(). A short explanation later and they were on board, tickets were filed and we were on the way. Of course, what will the rest of the dev community think?

From Poll to Production

We polled developers to discover what people thought of the proposed change. An overwhelming positive response to the proposal. As a result, some bugs were filed:

FTW

This whole story is cool for two reasons. First off, we have succeeded in updating an old definitely to represent something much more in line with modern standards. Secondly, this was all accomplished through open web collaboration allowing for a huge benefit to the development community.

So please do enjoy the new definition of $ in Chrome DevTools, Firefox, Firebug, and Opera Dragonfly.

(Big thanks to Ryan Olson for his help with this post. )


And like I mentioned, $ is part of the console's command line API which has brand new docs!. Go read it!

I dove into some of them a while ago in this video too:

EMBEDTHIS http://www.youtube.com/watch?v=4mf_yNLlgic

@paulirish
Copy link
Author

Written maybe 14 months ago.

@a7madgamal
Copy link

console's command line API which has brand new docs
mmm looks intresting
clicks the link
http://bblahhhhhhhhurl.com
:D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment