From b0ee0c01c2ae230d24ef603e1eb07ca6bc529b8f Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Sat, 8 Mar 2014 03:36:52 -0800 Subject: [PATCH] Deprecate jquery.mwExtension * Deprecating per Krinkle's comment on PS2 of Ie5f0e7d1c. * No usage in NS_MEDIAWIKI on Wikimedia wikis after these two edits: - https://www.mediawiki.org/w/index.php?diff=prev&oldid=923287 - https://www.mediawiki.org/w/index.php?diff=prev&oldid=923290 Change-Id: Ifb57ae9643bfc652c385b271a73f51577186f2d2 --- RELEASE-NOTES-1.26 | 1 + resources/src/jquery/jquery.mwExtension.js | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index 896d1d583e..852023bfc8 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -96,6 +96,7 @@ changes to languages because of Bugzilla reports. * The Block class constructor now takes an associative array of parameters instead of many optional positional arguments. Calling the constructor the old way will issue a deprecation warning. +* The jquery.mwExtension module was deprecated. == Compatibility == diff --git a/resources/src/jquery/jquery.mwExtension.js b/resources/src/jquery/jquery.mwExtension.js index e6e33ade11..548421286d 100644 --- a/resources/src/jquery/jquery.mwExtension.js +++ b/resources/src/jquery/jquery.mwExtension.js @@ -1,9 +1,11 @@ /* * JavaScript backwards-compatibility alternatives and other convenience functions + * + * @deprecated since 1.26 Dated collection of miscellaneous utilities. Methods are + * either trivially inline, obsolete, or have a better place elsewhere. */ -( function ( $ ) { - - $.extend( { +( function ( $, mw ) { + $.each( { trimLeft: function ( str ) { return str === null ? '' : str.toString().replace( /^\s+/, '' ); }, @@ -14,9 +16,6 @@ ucFirst: function ( str ) { return str.charAt( 0 ).toUpperCase() + str.slice( 1 ); }, - escapeRE: function ( str ) { - return str.replace( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' ); - }, isDomElement: function ( el ) { return !!el && !!el.nodeType; }, @@ -28,7 +27,7 @@ return true; } // the for-loop could potentially contain prototypes - // to avoid that we check it's length first + // to avoid that we check its length first if ( v.length === 0 ) { return true; } @@ -117,6 +116,12 @@ } return true; } + }, function ( key, value ) { + mw.log.deprecate( $, key, value ); } ); -}( jQuery ) ); + mw.log.deprecate( $, 'escapeRE', function ( str ) { + return str.replace( /([\\{}()|.?*+\-\^$\[\]])/g, '\\$1' ); + }, 'Use mediawiki.RegExp instead.' ); + +} )( jQuery, mediaWiki ); -- 2.20.1