Skip to content

Commit 3a6eb19

Browse files
author
Luikore
committed
Fix rendering double quotes in html attributes
1 parent e7093ae commit 3a6eb19

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ function attrs (obj) {
127127
for (var key in obj) {
128128
if (typeof obj[key] === 'boolean' && obj[key]) {
129129
attr += ' ' + key
130-
} else if (
131-
typeof obj[key] === 'string' ||
132-
typeof obj[key] === 'number'
133-
) {
130+
} else if (typeof obj[key] === 'number') {
134131
attr += ' ' + key + '="' + obj[key] + '"'
132+
} else if (typeof obj[key] === 'string') {
133+
attr += ' ' + key + '="' + obj[key].replace(/"/g, '"') + '"'
135134
}
136135
}
137136

0 commit comments

Comments
 (0)