瀏覽代碼

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 14 年之前
父節點
當前提交
172c34a24f
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. +1
    -1
      mustache.js

+ 1
- 1
mustache.js 查看文件

@@ -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;
});
}


Loading…
取消
儲存