Disable jQuery Migrate by default (enable via $wgIncludejQueryMigrate)
authorJames D. Forrester <jforrester@wikimedia.org>
Fri, 16 May 2014 15:04:12 +0000 (16:04 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 3 Jun 2014 20:25:54 +0000 (22:25 +0200)
Follows-up e5502d1f and 63c36506.

Per the plan[1], after a few weeks of migration, the jQuery Migrate plugin
will be disabled in MediaWiki core.

The added configuration variable allows sysadmins to continue to use code
that is not yet compatible with jQuery 1.9 and higher (e.g. extensions
and/or gadgets that still use legacy jQuery functionality).

[1] http://www.mail-archive.com/wikitech-l@lists.wikimedia.org/msg75735.html

Bug: 44740
Change-Id: If1c9ab722c7ce025b550b457506dcdf90d3326c3

RELEASE-NOTES-1.24
includes/DefaultSettings.php
resources/Resources.php

index 0389b7c..d524b6b 100644 (file)
@@ -35,7 +35,10 @@ production.
 * (bug 49156) Added the mediawiki.cookie ResourceLoader module, which wraps
   jQuery.cookie so that getting/setting a cookie is syntactically and functionally
   similar to using the WebRequest#getCookie/WebResponse#setcookie methods.
-* (bug 44740) jQuery upgraded from 1.8.3 to 1.11.1.
+* (bug 44740) jQuery upgraded from 1.8.3 to 1.11.1. A new configuration option,
+  $wgIncludejQueryMigrate, also loads the jQuery Migrate hack to let extensions
+  and gadgets use the long-deprecated functions that were removed in jQuery 1.9.
+  This option is turned off by default, and will be removed in MediaWiki 1.25.
 * Changes to content typography (fonts, etc.). See
   https://www.mediawiki.org/wiki/Typography_refresh for further information.
 * WikitextContent will now render redirects with the expected "redirect"
index ab0ffeb..1727aed 100644 (file)
@@ -3221,6 +3221,15 @@ $wgResourceLoaderMinifierMaxLineLength = 1000;
  */
 $wgIncludeLegacyJavaScript = true;
 
+/**
+ * Whether to include the jQuery Migrate library, which lets legacy JS that
+ * requires jQuery 1.8.x to work and breaks with 1.9.x+.
+ *
+ * @since 1.24
+ * @deprecated since 1.24, to be removed in 1.25
+ */
+$wgIncludejQueryMigrate = false;
+
 /**
  * Whether to preload the mediawiki.util module as blocking module in the top
  * queue.
index aee1864..9ff7890 100644 (file)
@@ -186,10 +186,14 @@ return array(
        /* jQuery */
 
        'jquery' => array(
-               'scripts' => array(
-                       'resources/lib/jquery/jquery.js',
-                       'resources/lib/jquery/jquery.migrate.js',
-               ),
+               'scripts' => ( $GLOBALS['wgIncludejQueryMigrate'] ?
+                       array(
+                               'resources/lib/jquery/jquery.js',
+                               'resources/lib/jquery/jquery.migrate.js'
+                       ) :
+                       array(
+                               'resources/lib/jquery/jquery.js'
+                       ) ),
                'debugRaw' => false,
                'targets' => array( 'desktop', 'mobile' ),
        ),