}
parts = ( mw.msg( 'word-separator' ) + mw.msg( 'brackets' ) ).split( '$1' );
- regexp = new RegExp( $.map( parts, mw.RegExp.escape ).join( '.*?' ) + '$' );
+ regexp = new RegExp( parts.map( mw.RegExp.escape ).join( '.*?' ) + '$' );
newTitle = oldTitle.replace( regexp, '' );
accessKeyLabel = getAccessKeyLabel( element );
}
// We override the animation for all of these color styles
- $.each( [
+ [
'backgroundColor',
'borderBottomColor',
'borderLeftColor',
'borderTopColor',
'color',
'outlineColor'
- ], function ( i, attr ) {
+ ].forEach( function ( attr ) {
$.fx.step[ attr ] = function ( fx ) {
if ( !fx.colorInit ) {
fx.start = getColor( fx.elem, attr );
// Attributes
// Note: there's no way to prevent escaping of values being injected into attributes, this is
// on purpose, not a design flaw.
- $.each( attributes, function ( i, attr ) {
+ attributes.forEach( function ( attr ) {
var msgAttr = attr + '-msg';
$target.find( '[' + msgAttr + ']' ).each( function () {
var $el = $( this );
if ( node.tagName.toLowerCase() === 'img' ) {
return $node.attr( 'alt' ) || ''; // handle undefined alt
}
- return $.map( $.makeArray( node.childNodes ), function ( elem ) {
+ return $.makeArray( node.childNodes ).map( function ( elem ) {
if ( elem.nodeType === Node.ELEMENT_NODE ) {
return getElementSortKey( elem );
}
*
* Loading this module also ensures the availability of appropriate messages via mw.msg.
*/
-( function ( mw, $ ) {
+( function ( mw ) {
var
monthMessages = [
'january', 'february', 'march', 'april',
'sep', 'oct', 'nov', 'dec'
];
- // Function suitable for passing to jQuery.map
- // Can't use mw.msg directly because jQuery.map passes element index as second argument
+ // Function suitable for passing to Array.prototype.map
+ // Can't use mw.msg directly because Array.prototype.map passes element index as second argument
function mwMsgMapper( key ) {
return mw.msg( key );
}
genitive: monthGenMessages,
abbrev: monthAbbrevMessages
},
- names: $.map( monthMessages, mwMsgMapper ),
- genitive: $.map( monthGenMessages, mwMsgMapper ),
- abbrev: $.map( monthAbbrevMessages, mwMsgMapper )
+ names: monthMessages.map( mwMsgMapper ),
+ genitive: monthGenMessages.map( mwMsgMapper ),
+ abbrev: monthAbbrevMessages.map( mwMsgMapper )
};
-}( mediaWiki, jQuery ) );
+}( mediaWiki ) );
*
* @deprecated since 1.26
*/
- $.each( [ 'write', 'writeln' ], function ( idx, method ) {
+ [ 'write', 'writeln' ].forEach( function ( method ) {
mw.log.deprecate( document, method, function () {
$( 'body' ).append( $.parseHTML( Array.prototype.join.call( arguments, '' ) ) );
}, 'Use jQuery or mw.loader.load instead.', 'document.' + method );
multi: function () {
var map = this.paramInfo.submodules,
v = this.isDisabled() ? this.paramInfo[ 'default' ] : this.getApiValue();
- return v === undefined || v === '' ? [] : $.map( String( v ).split( '|' ), function ( v ) {
+ return v === undefined || v === '' ? [] : String( v ).split( '|' ).map( function ( v ) {
return { value: v, path: map[ v ] };
} );
}
throw new Error( 'Unknown parameter type ' + pi.type );
}
- items = $.map( pi.type, function ( v ) {
+ items = pi.type.map( function ( v ) {
var config = {
data: String( v ),
label: String( v ),
option, options;
if ( $selected.attr( 'data-subprojects' ) ) {
- options = $.map( $selected.attr( 'data-subprojects' ).split( ' ' ), function ( el ) {
+ options = $selected.attr( 'data-subprojects' ).split( ' ' ).map( function ( el ) {
option = document.createElement( 'option' );
option.appendChild( document.createTextNode( el ) );
option.setAttribute( 'value', el );
* @method
*/
abort: function () {
- $.each( this.requests, function ( index, request ) {
+ this.requests.forEach( function ( request ) {
if ( request ) {
request.abort();
}
var modules = inspect.getLoadedModules(),
graph = {};
- $.each( modules, function ( moduleIndex, moduleName ) {
+ modules.forEach( function ( moduleName ) {
var dependencies = mw.loader.moduleRegistry[ moduleName ].dependencies || [];
if ( !hasOwn.call( graph, moduleName ) ) {
* @return {Array} List of module names
*/
getLoadedModules: function () {
- return $.grep( mw.loader.getModuleNames(), function ( module ) {
+ return mw.loader.getModuleNames().filter( function ( module ) {
return mw.loader.getState( module ) === 'ready';
} );
},
Array.prototype.slice.call( arguments ) :
$.map( inspect.reports, function ( v, k ) { return k; } );
- $.each( reports, function ( index, name ) {
+ reports.forEach( function ( name ) {
inspect.dumpTable( inspect.reports[ name ]() );
} );
},
*/
size: function () {
// Map each module to a descriptor object.
- var modules = $.map( inspect.getLoadedModules(), function ( module ) {
+ var modules = inspect.getLoadedModules().map( function ( module ) {
return {
name: module,
size: inspect.getModuleSize( module )
sortByProperty( modules, 'size', true );
// Convert size to human-readable string.
- $.each( modules, function ( i, module ) {
+ modules.forEach( function ( module ) {
module.sizeInBytes = module.size;
module.size = humanSize( module.size );
} );
css: function () {
var modules = [];
- $.each( inspect.getLoadedModules(), function ( index, name ) {
+ inspect.getLoadedModules().forEach( function ( name ) {
var css, stats, module = mw.loader.moduleRegistry[ name ];
try {
pattern = new RegExp( mw.RegExp.escape( pattern ), 'g' );
}
- return $.grep( inspect.getLoadedModules(), function ( moduleName ) {
+ return inspect.getLoadedModules().filter( function ( moduleName ) {
var module = mw.loader.moduleRegistry[ moduleName ];
// Grep module's JavaScript
} );
}
- $.each( dependencies, function ( idx, module ) {
+ dependencies.forEach( function ( module ) {
var state = mw.loader.getState( module );
// Only queue modules that are still in the initial 'registered' state
// (not ones already loading, ready or error).