-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug in the way jquery.init.js was being used.
- Loading branch information
1 parent
eb343e8
commit 1def59f
Showing
3 changed files
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
var yl = yl || {}; | ||
// Directly above this file, we included the jQuery provided by django. That | ||
// means it set itself to window.$ and window.jQuery, and stored away any | ||
// existing jQuery that may have been installed previously. Calling | ||
// jQuery.noConflict(true) will remove OUR copy of jQuery from the global | ||
// namespace and restore the original values of window.$ and window.jQuery. | ||
// This is necessary so that code which uses a version of jQuery that may | ||
// have been installed up-page gets the version it expects. | ||
yl.jQuery = jQuery.noConflict(true); | ||
|
||
if (yl.jQuery === undefined) { | ||
/* If the user has included another copy of jQuery use that, even in the admin */ | ||
if (typeof $ !== 'undefined') | ||
yl.jQuery = $; | ||
else if ((typeof django !== 'undefined') && (typeof django.jQuery !== 'undefined')) | ||
yl.jQuery = django.jQuery; | ||
// Here, we set up django.jQuery, instead of letting admin/js/jquery.init.js | ||
// do it. This is necessary because it ALSO calls jQuery.noConflict(true). | ||
// It we let it do that, it would break any code further down the page that | ||
// expects window.$ and window.jQuery to be defined. | ||
var django = django || {}; | ||
if (typeof django.jQuery === 'undefined') { | ||
// If django.jQuery is not yet defined, we need to define it so that | ||
// admin/js/autocomplete.js (which we include with our widget) can run. | ||
django.jQuery = yl.jQuery; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters