diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index 90f7e62786..2399295f5b 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -115,7 +115,7 @@ ve.ce.MWTransclusionNode.static.filterRendering = function ( contentNodes ) {
} );
function isWhitespaceNode( node ) {
- return node && node.nodeType === Node.TEXT_NODE && !!node.data.match( whitespaceRegex );
+ return node && node.nodeType === Node.TEXT_NODE && whitespaceRegex.test( node.data );
}
while ( isWhitespaceNode( contentNodes[ 0 ] ) ) {
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index 5e49e6bd7c..20f6b57a90 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -325,34 +325,32 @@ ve.dm.MWTransclusionNode.static.escapeParameter = function ( param ) {
if ( inNowiki ) {
if ( match[ 0 ] === '' ) {
inNowiki = false;
- output += match[ 0 ];
- } else {
- output += match[ 0 ];
}
+ output += match[ 0 ];
} else {
var needsNowiki = true;
if ( match[ 0 ] === '
/ ); + // Anything but what's matched below + all = !/^ |^=|^/.test( text ); break; case 'mwPreformatted': all = text.slice( 0, 1 ) === ' '; @@ -45,8 +46,8 @@ ve.dm.MWWikitextSurfaceFragment.prototype.hasMatchingAncestor = function ( type, all = text.slice( 0, 12 ) === ''; break; case 'mwHeading': - all = text.match( new RegExp( '^={' + attributes.level + '}[^=]' ) ) && - text.match( new RegExp( '[^=]={' + attributes.level + '}$' ) ); + all = new RegExp( '^={' + attributes.level + '}[^=]' ).test( text ) && + new RegExp( '[^=]={' + attributes.level + '}$' ).test( text ); break; default: all = false; diff --git a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js index 4e5167930a..2cc894509c 100644 --- a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js +++ b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js @@ -475,7 +475,7 @@ // We can detect that case by `content` being empty, and not retry. if ( useRestbase && resp.visualeditor.content && ( !resp.visualeditor.etag || - !resp.visualeditor.etag.match( etagRegexp ) + !etagRegexp.test( resp.visualeditor.etag ) ) ) { // Direct request to RESTBase returned a mangled or missing etag. // Retry via the MediaWiki API. diff --git a/modules/ve-mw/preinit/ve.utils.parsoid.js b/modules/ve-mw/preinit/ve.utils.parsoid.js index 8be15803a8..e66e610d56 100644 --- a/modules/ve-mw/preinit/ve.utils.parsoid.js +++ b/modules/ve-mw/preinit/ve.utils.parsoid.js @@ -87,7 +87,7 @@ mw.libs.ve.restbaseIdRegExp = /^mw[a-zA-Z0-9\-_]{2,6}$/; mw.libs.ve.stripRestbaseIds = function ( doc ) { var restbaseIdRegExp = mw.libs.ve.restbaseIdRegExp; Array.prototype.forEach.call( doc.querySelectorAll( '[id^="mw"]' ), function ( element ) { - if ( element.id.match( restbaseIdRegExp ) ) { + if ( restbaseIdRegExp.test( element.id ) ) { element.removeAttribute( 'id' ); } } ); diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js index fe0d75a1c2..5e920405c4 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js @@ -813,9 +813,9 @@ ve.ui.MWMediaDialog.prototype.getLicenseIcon = function ( license ) { // FIXME: Structured data from Commons will make this properly // multilingual. For now, this is the limit of what is sensible. - if ( normalized.match( /^((cc )?pd|public domain)/ ) ) { + if ( /^((cc )?pd|public domain)/.test( normalized ) ) { return 'public-domain'; - } else if ( normalized.match( /^cc (by|sa)?/ ) ) { + } else if ( /^cc (by|sa)?/.test( normalized ) ) { return 'logoCC'; } else { return 'info'; diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js index 06ddc7bf32..b9acc4e278 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js @@ -221,7 +221,7 @@ ve.ui.MWSaveDialog.prototype.showPreview = function ( docOrMsg, baseDoc ) { } ); // Remove skin-specific modules (T187075 / T185284) modules = modules.filter( function ( module ) { - return ( module.match( /^(skins|mediawiki\.skinning)\./ ) === null ); + return !/^(skins|mediawiki\.skinning)\./.test( module ); } ); mw.loader.using( modules ); var body = docOrMsg.body; diff --git a/modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js b/modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js index f25bdf45c4..ead7bd5c7a 100644 --- a/modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js +++ b/modules/ve-mw/ui/ve.ui.MWWikitextCommandRegistry.js @@ -87,7 +87,7 @@ ve.ui.wikitextCommandRegistry.register( /* unwrapOffsetsCallback */ function ( text ) { /* Text is only italic if there are 2 or 5+ apostrophes */ - var matches = text.match( /^(''([^'].*|.*[^'])''|'{5,}([^'].*|.*[^'])'{5,})$/ ); + var matches = /^(''([^'].*|.*[^'])''|'{5,}([^'].*|.*[^'])'{5,})$/.test( text ); return matches ? [ 2, 2 ] : null; } diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js index fe73e67e78..6001819c2b 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWEditSummaryWidget.js @@ -89,7 +89,7 @@ ve.ui.MWEditSummaryWidget.static.getMatchingSummaries = function ( summaries, qu summaryPrefixMatches.push( summary ); } } else if ( index !== -1 ) { - if ( lowerSummary[ index - 1 ].match( /\s/ ) ) { + if ( /\s/.test( lowerSummary[ index - 1 ] ) ) { // Character before match is whitespace wordPrefixMatches.push( summary ); } else { diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaInfoFieldWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWMediaInfoFieldWidget.js index 08f199b9f2..26ebc76e50 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaInfoFieldWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaInfoFieldWidget.js @@ -60,7 +60,7 @@ ve.ui.MWMediaInfoFieldWidget = function VeUiMWMediaInfoFieldWidget( content, con // For the cases where we get urls that are "local" // without http(s) prefix, we will add that prefix // ourselves - !config.href.match( /^(https?:)?\/\// ) ? + !/^(https?:)?\/\//.test( config.href ) ? '//' + config.href : config.href )