0

Possible Duplicate:
What is the source of the double-dollar sign selector query function in Chrome /Ffirefox?

I noticed that many major Google sites (webapps) such as Search, Gmail, and Reader define not just a $ object but also a $$ object.

I'm not sure what the former is but the latter has at least a selector function similar to jQuery.

$$ is not full jQuery itself though. I can do things like $$('main') but not $$('main').text().

Does anyone know what this $$ object is? Is it a cutdown version of jQuery? Is it the Sizzle selector engine? Is it some other framework which looks a bit similar to jQuery?

Is it documented anywhere?

Bonus questions:

  • Is there some other object on Google sites with other jQuery functions?
  • What is the $ object they use?

Background: I've had some trouble getting jQuery to work in Google Chrome user scripts (like Greasemonkey) on Google sites no matter whether I inject jQuery into the sites using script tags or inject my userscript code into their pages to use whatever frameworks or libraries they might already include.

Community
  • 1
  • 1
hippietrail
  • 15,848
  • 18
  • 99
  • 158
  • 2
    Possible dup http://stackoverflow.com/questions/8981211/what-is-the-source-of-the-double-dollar-sign-selector-query-function-in-chrome – elclanrs Nov 16 '12 at 04:49
  • @elclanrs: I think you're right. I am using Chrome and I found that there are both `$` and `$$` objects even in `about:blank`! – hippietrail Nov 16 '12 at 04:52
  • I think latest Chrome redefined the meaning of `$` and `$$` a little bit, so it might not be the same as Firebug, but yes, those are browser variables AFAIK. – elclanrs Nov 16 '12 at 04:56

1 Answers1

2

Google doesn't use jQuery in its webapps. Instead, Google uses its own javascript library, called Closure Library in almost all of its webapps(mail, docs, map, plus). This library has been open sourced in 2009 on google code. This is the link

What's more, Google has written a javascript compiler(or optimizer, to be more precise) called Closure Compiler to use together with the closure library.

There is a full page on developers.google.com about the closure tools. This is the link

lins05
  • 418
  • 3
  • 8
  • I knew that there was some kind of JavaScript compiler called Closure but I didn't know some of the other details. Thanks! – hippietrail Nov 16 '12 at 05:09