Javascript – Are Mootools and Google Closure Librarys Compatible

google-closuregoogle-closure-libraryjavascriptmootools

Anyone have any experience of using Closure js lib and Mootools in the same page?

Conflicts or works ok?

Best Solution

According to google:

The names of all Closure Library functions and properties begin with a dot-delimited path that prevents them from accidentally overlapping with names defined in non-Closure Library code. This path is called a namespace.

(http://code.google.com/closure/library/docs/introduction.html)

So there should be no conflicts, also I checked the API documentation and it reaffirms my findings, for example, for array manipulation you have to go through the google namespace (goog):

goog.array.binaryInsert(array, value, opt_compareFn)   ⇒
boolean

(http://closure-library.googlecode.com/svn/trunk/closure/goog/docs/closure_goog_array_array.js.html) This is unlike the MooTools extention of the Array class itself.

Cheers, Roman