aboutsummaryrefslogtreecommitdiffstats
path: root/src/exports.js
diff options
context:
space:
mode:
authorjrburke <jrburke@gmail.com>2011-11-14 12:13:25 -0500
committertimmywil <timmywillisn@gmail.com>2011-11-14 12:13:25 -0500
commit8bc60bab5dd9747e7ae06c3fdb0c60782d346ff0 (patch)
tree90008a3a96f1ccb50f0a69f3f782fdcf3f075a8c /src/exports.js
parent499d7e409c4f4d4ed255148e59552763cccf4260 (diff)
downloadjquery-8bc60bab5dd9747e7ae06c3fdb0c60782d346ff0.tar.gz
jquery-8bc60bab5dd9747e7ae06c3fdb0c60782d346ff0.zip
Landing pull request 586. Create exports.js for exporting jQuery to window and AMD. Fixes #10687.
More Details: - https://github.com/jquery/jquery/pull/586 - http://bugs.jquery.com/ticket/10687
Diffstat (limited to 'src/exports.js')
-rw-r--r--src/exports.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/exports.js b/src/exports.js
new file mode 100644
index 000000000..7d8964f01
--- /dev/null
+++ b/src/exports.js
@@ -0,0 +1,22 @@
+(function( jQuery ) {
+
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+})( jQuery );