django-debug-toolbar/django-debug-toolbar — pull request #591 by mbarrien (2014-04-29 21:36:03+00:00)
Title: undefine "define" to avoid requirejs conflict

Even with the vendored RequireJS and the call to noConflict(), we are still having problems using Django Debug Toolbar.

Even though the function noConflict removes jquery from the global namespace, simply including the jquery.js script still affects the jquery loaded by RequireJS, since the following lines in jquery.js from http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.js are run unconditionally, and are not undone by noConflict:
```
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function() {
return jQuery;
});
}
```

This patch temporarily undefines RequireJS's "define" while loading the vendored jQuery, preventing itself from registering.

This is especially important in our case, where we have no global jQuery since it is only loaded via RequireJS. Our jQuery is loaded asynchronously, and since this vendored version of jQuery is loaded inline syncrhonously, this affects loading of other things that require jQuery.