Skip to content

Commit f9a4287

Browse files
committed
Lint fixes
1 parent f983035 commit f9a4287

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

functions/strings/get_html_translation_table.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ function get_html_translation_table (table, quote_style) {
2020
// * returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
2121
var entities = {},
2222
hash_map = {},
23-
decimal = 0,
24-
symbol = '';
23+
decimal;
2524
var constMappingTable = {},
2625
constMappingQuoteStyle = {};
2726
var useTable = {},
@@ -154,8 +153,9 @@ function get_html_translation_table (table, quote_style) {
154153

155154
// ascii decimals to real symbols
156155
for (decimal in entities) {
157-
symbol = String.fromCharCode(decimal);
158-
hash_map[symbol] = entities[decimal];
156+
if (entities.hasOwnProperty(decimal)) {
157+
hash_map[String.fromCharCode(decimal)] = entities[decimal];
158+
}
159159
}
160160

161161
return hash_map;

functions/strings/htmlentities.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ function htmlentities (string, quote_style, charset, double_encode) {
2929

3030
if (!!double_encode || double_encode == null) {
3131
for (symbol in hash_map) {
32-
string = string.split(symbol).join(hash_map[symbol]);
32+
if (hash_map.hasOwnProperty(symbol)) {
33+
string = string.split(symbol).join(hash_map[symbol]);
34+
}
3335
}
3436
} else {
3537
string = string.replace(/([\s\S]*?)(&(?:#\d+|#x[\da-f]+|[a-zA-Z][\da-z]*);|$)/g, function (ignore, text, entity) {
3638
for (symbol in hash_map) {
37-
text = text.split(symbol).join(hash_map[symbol]);
39+
if (hash_map.hasOwnProperty(symbol)) {
40+
text = text.split(symbol).join(hash_map[symbol]);
41+
}
3842
}
3943

4044
return text + entity;

0 commit comments

Comments
 (0)