提交 ad49a03d 编写于 作者: S sushuang

tweak.

上级 cb766b79
...@@ -35,13 +35,22 @@ export function toCamelCase(str, upperCaseFirst) { ...@@ -35,13 +35,22 @@ export function toCamelCase(str, upperCaseFirst) {
export var normalizeCssArray = zrUtil.normalizeCssArray; export var normalizeCssArray = zrUtil.normalizeCssArray;
var replaceReg = /([&<>"'])/g;
var replaceMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#39;',
};
export function encodeHTML(source) { export function encodeHTML(source) {
return String(source) return source == null
.replace(/&/g, '&amp;') ? ''
.replace(/</g, '&lt;') : (source + '').replace(replaceReg, function (str, char) {
.replace(/>/g, '&gt;') return replaceMap[char];
.replace(/"/g, '&quot;') });
.replace(/'/g, '&#39;');
} }
var TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; var TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册