HTMLForm: Avoid usage of non-standard 'flags' parameter of String#replace

Chrome (and most other browser) don't support the non-standard 'flags'
argument to String#replace (implemented by Mozilla Firefox). Instead pass
a RegExp object with those flags.

Bug: 68050
Change-Id: Ia463002e708975eed1a5c3657f2e1a4d6b4e74de
This commit is contained in:
Brad Jorsch 2014-07-16 17:04:20 -04:00 committed by Ori.livneh
parent 6f02280988
commit 9538e7d77c
2 changed files with 5 additions and 1 deletions

View file

@ -862,6 +862,9 @@ return array(
),
'mediawiki.htmlform' => array(
'scripts' => 'resources/src/mediawiki/mediawiki.htmlform.js',
'dependencies' => array(
'jquery.mwExtension',
),
'messages' => array( 'htmlform-chosen-placeholder' ),
),
'mediawiki.icon' => array(

View file

@ -363,7 +363,8 @@
$ul = $( this ).prev( 'ul.mw-htmlform-cloner-ul' );
html = $ul.data( 'template' ).replace(
$ul.data( 'uniqueId' ), 'clone' + ( ++cloneCounter ), 'g'
new RegExp( $.escapeRE( $ul.data( 'uniqueId' ) ), 'g' ),
'clone' + ( ++cloneCounter )
);
$li = $( '<li>' )