Merge "ResourceLoader::makeLoaderImplementScript: Bind args as '$' and 'jQuery'"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 14 Apr 2014 20:53:47 +0000 (20:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 14 Apr 2014 20:53:47 +0000 (20:53 +0000)
RELEASE-NOTES-1.23
includes/resourceloader/ResourceLoader.php

index 08fb7a2..d0a8ec7 100644 (file)
@@ -341,6 +341,13 @@ changes to languages because of Bugzilla reports.
 * The locations of resources have been split between upstream libraries, now in
   resources/lib/, local libaries in resources/src/, and local forks of upstream
   libraries, also in resources/src/.
+* BREAKING CHANGE: The automatically-generated function closure with which
+  ResourceLoader wraps all modules' JavaScript code now binds the identifier
+  names 'jQuery' and '$' to the jQuery object of the version of jQuery that is
+  bundled with MediaWiki. If you bind these names to other objects in global
+  scope (like Zepto.js or document.querySelectorAll, for example) you will need
+  to use different names to or re-bind them at the top of each
+  ResourceLoader-loaded module.
 
 ==== Removed classes ====
 * FakeMemCachedClient (deprecated in 1.18)
index 77659f6..eac6a02 100644 (file)
@@ -935,7 +935,7 @@ class ResourceLoader {
         */
        public static function makeLoaderImplementScript( $name, $scripts, $styles, $messages ) {
                if ( is_string( $scripts ) ) {
-                       $scripts = new XmlJsCode( "function () {\n{$scripts}\n}" );
+                       $scripts = new XmlJsCode( "function ( $, jQuery ) {\n{$scripts}\n}" );
                } elseif ( !is_array( $scripts ) ) {
                        throw new MWException( 'Invalid scripts error. Array of URLs or string of code expected.' );
                }