mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 07:34:11 +00:00
Merge "ext.popups.renderer.article.js: Use mw.RegExp.escape() for RegExp escaping"
This commit is contained in:
commit
eaf71a1d4b
|
@ -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