Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16776 -- Fixed a regression introduced in r16415 which caused …

…Django's embedded jQuery to overwrite any pre-existing values of `window.jQuery` in the global namespace. Many thanks to Rob Hudson, Jannis Leidel and "anonymous" for the help resolving this issue.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4da7c772add8650cf01c4f3692271cba5b07e642 1 parent 3b22c68
Julien Phalip authored October 13, 2011
8  django/contrib/admin/static/admin/js/jquery.init.js
... ...
@@ -1,4 +1,8 @@
1  
-// Puts the included jQuery into our own namespace
  1
+/* Puts the included jQuery into our own namespace using noConflict and passing
  2
+ * it 'true'. This ensures that the included jQuery doesn't pollute the global
  3
+ * namespace (i.e. this preserves pre-existing values for both window.$ and
  4
+ * window.jQuery).
  5
+ */
2 6
 var django = {
3  
-    "jQuery": jQuery.noConflict()
  7
+    "jQuery": jQuery.noConflict(true)
4 8
 };
12  docs/ref/contrib/admin/index.txt
@@ -1289,10 +1289,14 @@ The :doc:`staticfiles app </ref/contrib/staticfiles>` prepends
1289 1289
 definitions on forms <form-media-paths>`.
1290 1290
 
1291 1291
 Django admin Javascript makes use of the `jQuery`_ library. To avoid
1292  
-conflict with user scripts, Django's jQuery is namespaced as
1293  
-``django.jQuery``. If you want to use jQuery in your own admin
1294  
-JavaScript without including a second copy, you can use the
1295  
-``django.jQuery`` object on changelist and add/edit views.
  1292
+conflicts with user-supplied scripts or libraries, Django's jQuery is
  1293
+namespaced as ``django.jQuery``. If you want to use jQuery in your own admin
  1294
+JavaScript without including a second copy, you can use the ``django.jQuery``
  1295
+object on changelist and add/edit views.
  1296
+
  1297
+If you require the jQuery library to be in the global namespace, for example
  1298
+when using third-party jQuery plugins, or need a newer version of jQuery, you
  1299
+will have to include your own copy of jQuery.
1296 1300
 
1297 1301
 .. _jQuery: http://jquery.com
1298 1302
 

0 notes on commit 4da7c77

Please sign in to comment.
Something went wrong with that request. Please try again.