Skip to content

Commit 622167f

Browse files
committed
feat(htmlTag): boolean attribute
1 parent a1e9a79 commit 622167f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/html_tag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function htmlTag(tag, attrs, text, escape = true) {
2424
if (attrs[i] === null || typeof attrs[i] === 'undefined') result += '';
2525
else {
2626
if (i.match(regexUrl)) result += ` ${escapeHTML(i)}="${encodeURL(attrs[i])}"`;
27-
else if (attrs[i] === true) result += ` ${escapeHTML(i)}`;
27+
else if (attrs[i] === true || i === attrs[i]) result += ` ${escapeHTML(i)}`;
2828
else if (i.match(/srcset$/i)) result += ` ${escapeHTML(i)}="${encSrcset(attrs[i])}"`;
2929
else result += ` ${escapeHTML(i)}="${escapeHTML(String(attrs[i]))}"`;
3030
}

0 commit comments

Comments
 (0)