Explorar el Código

Bug fix: do not escape & in ' entity for apostrophe

The fix consists in adding #? in the negative look-ahead expected to reject
entity references:
  &          // character '&'
  (?!        // not followed by
    #?       //   an optional # (numerical entity), followed by
    \w+      //   a word, followed by
    ;        //   character ';'
  )

instead of
  &          // character '&'
  (?!        // not followed by
    \w+      //   a word, followed by
    ;        //   character ';'
  )
tags/0.4.1
Eric Bréchemier hace 14 años
padre
commit
172c34a24f
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. +1
    -1
      mustache.js

+ 1
- 1
mustache.js Ver fichero

@@ -44,7 +44,7 @@ var Mustache = function () {
};

function escapeHTML(string) {
return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) {
return String(string).replace(/&(?!#?\w+;)|[<>"']/g, function (s) {
return escapeMap[s] || s;
});
}


Cargando…
Cancelar
Guardar