|
|
@@ -206,29 +206,27 @@ export default {
|
|
|
},
|
|
|
|
|
|
escapeHTML (text) {
|
|
|
- if (typeof text === 'string') {
|
|
|
+ if (!text) {
|
|
|
return text
|
|
|
- .replace(/&/g, '&')
|
|
|
- .replace(/</g, '<')
|
|
|
- .replace(/>/g, '>')
|
|
|
- .replace(/"/g, '"')
|
|
|
- .replace(/'/g, ''')
|
|
|
- .replace(/`/g, '`')
|
|
|
}
|
|
|
- return text
|
|
|
+ return text.toString()
|
|
|
+ .replace(/&/g, '&')
|
|
|
+ .replace(/</g, '<')
|
|
|
+ .replace(/>/g, '>')
|
|
|
+ .replace(/"/g, '"')
|
|
|
+ .replace(/'/g, ''')
|
|
|
},
|
|
|
|
|
|
unescapeHTML (text) {
|
|
|
- if (typeof text === 'string') {
|
|
|
+ if (!text) {
|
|
|
return text
|
|
|
- .replace(/&/g, '&')
|
|
|
- .replace(/</g, '<')
|
|
|
- .replace(/>/g, '>')
|
|
|
- .replace(/"/g, '"')
|
|
|
- .replace(/'/g, '\'')
|
|
|
- .replace(/`/g, '`')
|
|
|
}
|
|
|
- return text
|
|
|
+ return text.toString()
|
|
|
+ .replace(/&/g, '&')
|
|
|
+ .replace(/</g, '<')
|
|
|
+ .replace(/>/g, '>')
|
|
|
+ .replace(/"/g, '"')
|
|
|
+ .replace(/'/g, '\'')
|
|
|
},
|
|
|
|
|
|
getRealDataAttr (dataAttr) {
|