From c393f874706ea4683762b37305401432e0473940 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 3 Jun 2014 13:51:39 -0700 Subject: [PATCH] Remove jQuery Migrate and $wgIncludejQueryMigrate As indicated in MediaWiki 1.24, removing the jQuery Migrate bridging patch that allows legacy Javascript code that depends ancient features of jQuery removed in jQuery 1.9 to work. Change-Id: I0934247182e2737716c9d40f4bf93415adcdadf3 --- RELEASE-NOTES-1.25 | 3 + includes/DefaultSettings.php | 9 - resources/Resources.php | 11 +- resources/lib/jquery/jquery.migrate.js | 551 ------------------------- 4 files changed, 6 insertions(+), 568 deletions(-) delete mode 100644 resources/lib/jquery/jquery.migrate.js diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index ce825e553f..36d698f9f6 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -29,6 +29,9 @@ production. * $wgOpenSearchTemplate is deprecated in favor of $wgOpenSearchTemplates. * Edits are now prepared via AJAX as users type edit summaries. This behavior can be disabled via $wgAjaxEditStash. +* (bug 44740) The temporary option $wgIncludejQueryMigrate was removed, along + with the jQuery Migrate library, as indicated when this option was provided in + MediaWiki 1.24. === New features in 1.25 === * (T64861) Updated plural rules to CLDR 26. Includes incompatible changes diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index e644e09884..64d9892cdc 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3413,15 +3413,6 @@ $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. diff --git a/resources/Resources.php b/resources/Resources.php index 72cc2ef647..d6a3181559 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -121,14 +121,9 @@ return array( /* jQuery */ 'jquery' => array( - 'scripts' => ( $GLOBALS['wgIncludejQueryMigrate'] ? - array( - 'resources/lib/jquery/jquery.js', - 'resources/lib/jquery/jquery.migrate.js' - ) : - array( - 'resources/lib/jquery/jquery.js' - ) ), + 'scripts' => array( + 'resources/lib/jquery/jquery.js', + ), 'raw' => true, 'targets' => array( 'desktop', 'mobile' ), ), diff --git a/resources/lib/jquery/jquery.migrate.js b/resources/lib/jquery/jquery.migrate.js deleted file mode 100644 index 5b18236659..0000000000 --- a/resources/lib/jquery/jquery.migrate.js +++ /dev/null @@ -1,551 +0,0 @@ -/*! - * jQuery Migrate - v1.2.1 - 2013-05-08 - * https://github.com/jquery/jquery-migrate - * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT - * - * Patched for MediaWiki to add mw.track calls. --Krinkle 2014-04-14 - */ -(function( jQuery, window, undefined ) { -// See http://bugs.jquery.com/ticket/13335 -// "use strict"; - - -var warnedAbout = {}; - -// List of warnings already given; public read only -jQuery.migrateWarnings = []; - -// Set to true to prevent console output; migrateWarnings still maintained -// jQuery.migrateMute = false; - -// Show a message on the console so devs know we're active -if ( !jQuery.migrateMute && window.console && window.console.log ) { - window.console.log("JQMIGRATE: Logging is active"); -} - -// Set to false to disable traces that appear with warnings -if ( jQuery.migrateTrace === undefined ) { - jQuery.migrateTrace = true; -} - -// Forget any warnings we've already given; public -jQuery.migrateReset = function() { - warnedAbout = {}; - jQuery.migrateWarnings.length = 0; -}; - -function migrateWarn( msg, key ) { - var console = window.console; - /* - MediaWiki patch for tracking usage. - - Custom keys: - - andSelf - - attr-pass - - attr-prop - - bind-error - - clean - - create-html - - data-events - - die - - event-ajax - - event-global - - event-hover - - event-handle - - input-type - - json-invalid - - live - - sub - - toggle-handle - - Prop keys: - - attrFn - - browser - */ - mw.track( "jquery.migrate", key || "unknown" ); - - if ( !warnedAbout[ msg ] ) { - warnedAbout[ msg ] = true; - jQuery.migrateWarnings.push( msg ); - if ( console && console.warn && !jQuery.migrateMute ) { - console.warn( "JQMIGRATE: " + msg ); - if ( jQuery.migrateTrace && console.trace ) { - console.trace(); - } - } - } -} - -function migrateWarnProp( obj, prop, value, msg, key ) { - if ( Object.defineProperty ) { - // On ES5 browsers (non-oldIE), warn if the code tries to get prop; - // allow property to be overwritten in case some other plugin wants it - try { - Object.defineProperty( obj, prop, { - configurable: true, - enumerable: true, - get: function() { - migrateWarn( msg, key || prop ); - return value; - }, - set: function( newValue ) { - migrateWarn( msg, key || prop ); - value = newValue; - } - }); - return; - } catch( err ) { - // IE8 is a dope about Object.defineProperty, can't warn there - } - } - - // Non-ES5 (or broken) browser; just set the property - jQuery._definePropertyBroken = true; - obj[ prop ] = value; -} - -if ( document.compatMode === "BackCompat" ) { - // jQuery has never supported or tested Quirks Mode - migrateWarn( "jQuery is not compatible with Quirks Mode" ); -} - - -var attrFn = jQuery( "", { size: 1 } ).attr("size") && jQuery.attrFn, - oldAttr = jQuery.attr, - valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get || - function() { return null; }, - valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set || - function() { return undefined; }, - rnoType = /^(?:input|button)$/i, - rnoAttrNodeType = /^[238]$/, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - ruseDefault = /^(?:checked|selected)$/i; - -// jQuery.attrFn -migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" ); - -jQuery.attr = function( elem, name, value, pass ) { - var lowerName = name.toLowerCase(), - nType = elem && elem.nodeType; - - if ( pass ) { - // Since pass is used internally, we only warn for new jQuery - // versions where there isn't a pass arg in the formal params - if ( oldAttr.length < 4 ) { - migrateWarn("jQuery.fn.attr( props, pass ) is deprecated", "attr-pass" ); - } - if ( elem && !rnoAttrNodeType.test( nType ) && - (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) { - return jQuery( elem )[ name ]( value ); - } - } - - // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking - // for disconnected elements we don't warn on $( "