Fix: remove escapeHtml completely

This commit is contained in:
eight 2017-09-12 20:03:24 +08:00
parent 39df704591
commit 431dbdc81c
3 changed files with 1 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* global semverCompare escapeHtml */
/* global semverCompare */
'use strict';

View File

@ -1,7 +1,6 @@
/* global CodeMirror messageBox */
/* global editors makeSectionVisible showCodeMirrorPopup showHelp */
/* global onDOMscripted injectCSS require CSSLint stylelint */
/* global escapeHtml */
'use strict';
loadLinterAssets();

View File

@ -272,14 +272,3 @@ function $element(opt) {
}
return element;
}
function escapeHtml(html, {limit} = {}) {
const chars = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;'};
let ellipsis = '';
if (limit && html.length > limit) {
html = html.substr(0, limit);
ellipsis = '...';
}
return html.replace(/[&<>"'/]/g, char => chars[char]) + ellipsis;
}