neo4j/community — pull request #310 by jakewins (2012-03-05 13:29:17+00:00)
Title: Webadmin imports cleanup

Some of the libraries webadmin uses, like jquery, arbor.js and backbone.js are "old" JS libraries, attaching themselves to the global namespace when you include them. Also, they depend on each other, but don't do anything to ensure they are loaded in the correct order. The rest of webadmin uses Asynchronous Module Definition, or AMD, to define dependencies and so on. This pull request introduces wrappers around the libraries that don't play nice with AMD.

There are two changes here: First, update webdriver to latest version to make it work with FF9, in order to test what follows afterwards.

Second: Change import code that looked like this:

require ['lib/jquery'], () ->
// jQuery is now globally defined

To something like this:

require ['lib/amd/jQuery'], ($) ->
// jQuery is now defined as "$" within the scope of this function.

And code that looked like this:

require ['order!lib/jquery','order!lib/backbone'], () ->
// Backbone is available, but we have to explicitly state it's dependencies in each file we import it

To this:

require ['lib/amd/Backbone'], (Backbone) ->
// Backbone is now defined as Backbone within the scope of this method, and it keeps track
// of its own dependency tree.