Remove unneeded grouping from regular expression (performance improvement)

This commit is contained in:
Davide P. Cervone 2014-11-20 09:35:56 -05:00
parent 7b5596fd4a
commit 142857afa2

View File

@ -160,7 +160,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
if (annotation) {
if (nested) {data.unshift(space+" <mrow>"); data.push(space+" </mrow>")}
data.unshift(space+" <semantics>");
var xmlEscapedTex = jax.originalText.replace(/([&<>])/g, function(item) {
var xmlEscapedTex = jax.originalText.replace(/[&<>]/g, function(item) {
return { '>': '&gt;', '<': '&lt;','&': '&amp;' }[item]
});
data.push(space+' <annotation encoding="'+annotation+'">'+xmlEscapedTex+"</annotation>");