if ( color && Array.isArray( color ) && color.length === 3 ) {
return color;
}
+ if ( typeof color !== 'string' ) {
+ return undefined;
+ }
// Look for rgb(num,num,num)
// eslint-disable-next-line no-cond-assign
}
// Otherwise, we're most likely dealing with a named color
- return $.colorUtil.colors[ $.trim( color ).toLowerCase() ];
+ return $.colorUtil.colors[ color.trim().toLowerCase() ];
},
/**
if ( rowIndex !== lastRowIndex ) {
lastRowIndex = rowIndex;
cellIndex = $( rows[ rowIndex ] ).data( 'columnToCell' )[ column ];
- nodeValue = $.trim( getElementSortKey( rows[ rowIndex ].cells[ cellIndex ] ) );
+ nodeValue = getElementSortKey( rows[ rowIndex ].cells[ cellIndex ] ).trim();
}
} else {
nodeValue = '';
},
format: function ( s ) {
var tsc;
- s = $.trim( s.toLowerCase() );
+ s = s.toLowerCase().trim();
if ( ts.collationRegex ) {
tsc = ts.collationTable;
s = s.replace( ts.collationRegex, function ( match ) {
return ts.rgx.url[ 0 ].test( s );
},
format: function ( s ) {
- return $.trim( s.replace( ts.rgx.url[ 1 ], '' ) );
+ return s.replace( ts.rgx.url[ 1 ], '' ).trim();
},
type: 'text'
} );
},
format: function ( s ) {
var match, y;
- s = $.trim( s.toLowerCase() );
+ s = s.toLowerCase().trim();
if ( ( match = s.match( ts.dateRegex[ 0 ] ) ) !== null ) {
if ( mw.config.get( 'wgDefaultDateFormat' ) === 'mdy' || mw.config.get( 'wgPageContentLanguage' ) === 'en' ) {
ts.addParser( {
id: 'number',
is: function ( s ) {
- return $.tablesorter.numberRegex.test( $.trim( s ) );
+ return $.tablesorter.numberRegex.test( s.trim() );
},
format: function ( s ) {
return $.tablesorter.formatDigit( s );
expiryWidget = infuseOrNull( 'mw-input-wpExpiry' );
function updateBlockOptions() {
- var blocktarget = $.trim( blockTargetWidget.getValue() ),
+ var blocktarget = blockTargetWidget.getValue().trim(),
isEmpty = blocktarget === '',
isIp = mw.util.isIPAddress( blocktarget, true ),
isIpRange = isIp && blocktarget.match( /\/\d+$/ ),
currentApiPromise = undefined;
}
- password = $.trim( password );
+ password = password.trim();
if ( password === '' ) {
self.setErrors( [] );
var apiPromise,
d = $.Deferred();
- if ( $.trim( $usernameInput.val() ) === '' ) {
+ if ( $usernameInput.val().trim() === '' ) {
d.resolve( { valid: true, messages: [] } );
return d.promise();
}
promises = [],
deferred = $.Deferred();
- if ( $.trim( input ) === '' ) {
+ if ( input.trim() === '' ) {
deferred.resolve( [] );
return deferred.promise();
}
oldClass = ( ' ' + $oldContainer.attr( 'class' ) + ' ' ).replace( /(mw-htmlform-field-HTMLMultiSelectField|mw-chosen|mw-htmlform-dropdown)/g, '' ),
$select = $( '<select>' ),
dataPlaceholder = mw.message( 'htmlform-chosen-placeholder' );
- oldClass = $.trim( oldClass );
+ oldClass = oldClass.trim();
$select.attr( {
name: name,
multiple: 'multiple',
namespace = defaultNamespace === undefined ? NS_MAIN : defaultNamespace;
// Normalise additional whitespace
- title = $.trim( title.replace( /\s/g, ' ' ) );
+ title = title.replace( /\s/g, ' ' ).trim();
// Process initial colon
if ( title !== '' && title[ 0 ] === ':' ) {
ext = parts.pop();
// Remove whitespace of the name part (that W/O extension)
- title = $.trim( parts.join( '.' ) );
+ title = parts.join( '.' ).trim();
// Cut, if too long and append file extension
title = trimFileNameToByteLength( title, ext );
} else {
// Missing file extension
- title = $.trim( parts.join( '.' ) );
+ title = parts.join( '.' ).trim();
// Name has no file extension and a fallback wasn't provided either
return null;
* @return {string} Localized namespace name
*/
ns: function ( nodes ) {
- var ns = $.trim( textify( nodes[ 0 ] ) );
+ var ns = textify( nodes[ 0 ] ).trim();
if ( !/^\d+$/.test( ns ) ) {
ns = mw.config.get( 'wgNamespaceIds' )[ ns.replace( / /g, '_' ).toLowerCase() ];
}
compile: function ( src ) {
return {
render: function () {
- return $( $.parseHTML( $.trim( src ) ) );
+ return $( $.parseHTML( src.trim() ) );
}
};
}