mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-09-23 18:29:35 +00:00
ext.popups.renderer.article.js: Use mw.RegExp.escape() for RegExp escaping
mw.RegExp.escape() is already used in ext.popups.core.js and the dependency to module 'mediawiki.RegExp' is set. Change-Id: Iaa7ab6902693c787234fd589276fa38ce75b82da
This commit is contained in:
parent
486e34fb38
commit
7ac7a2abd1
|
@ -169,7 +169,7 @@
|
|||
*/
|
||||
article.getProcessedElements = function ( extract, title ) {
|
||||
var elements = [],
|
||||
escapedTitle = title.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' ), // Escape RegExp elements
|
||||
escapedTitle = mw.RegExp.escape( title ), // Escape RegExp elements
|
||||
regExp = new RegExp( '(^|\\s)(' + escapedTitle + ')(|$)', 'ig' ),
|
||||
boldIdentifier = '<bi-' + Math.random() + '>',
|
||||
snip = '<snip-' + Math.random() + '>';
|
||||
|
|
Loading…
Reference in a new issue