Page MenuHomePhabricator

Incorrect treatment of Javascript template literal by ResourceLoader
Closed, DuplicatePublic

Description

Under MW 1.29.1, if I insert a template literal (surrounded by backticks) into a script in the MediaWiki namespace, the ResourceLoader gives a parse error.

This is the Javascript code:

function newMenuHTML (tools) {
	return `
<menu>
<ul>
<li></li>
</ul>
<menu>`;
}	// -- function newMenuHTML (tools)

And this is the error, which I can see in the browser console:

JavaScript parse error: Parse error: Illegal token in file 'MediaWiki:Gadget-edit2.js' on line 39 load.php:75:1064
<анонимная>
https://domain.name/w/load.php:75:1064
runScript/<
https://domain.name/w/load.php:161:89
fire
https://domain.name/w/load.php:45:104
add
https://domain.name/w/load.php:45:656
always
https://domain.name/w/load.php:46:865
runScript
https://domain.name/w/load.php:160:944
checkCssHandles
https://domain.name/w/load.php:161:678
cssHandle/<
https://domain.name/w/load.php:161:808
fire
https://domain.name/w/load.php:45:104
fireWith
https://domain.name/w/load.php:46:431
fire
https://domain.name/w/load.php:46:474
fireCallbacks
https://domain.name/w/load.php:156:320
addEmbeddedCSS
https://domain.name/w/load.php:156:661
addEmbeddedCSS/cssBufferTimer<
https://domain.name/w/load.php:156:538