Skip to content

Commit

Permalink
makes the changes requested
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonyte committed Sep 24, 2024
1 parent 344c408 commit c884bd4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ function sanitizeHtml(html, options, _recursing) {

const { selfClosing } = options;
if (Array.isArray(selfClosing)) {
options.selfClosing = selfClosing.reduce((before, tagName) => ({
...before,
[tagName]: true
}), {});
options.selfClosing = {};
for (let i = 0; i < selfClosing.length; i++) {
options.selfClosing[selfClosing[i]] = true;
}
}

const tagAllowed = function(name) {
Expand Down Expand Up @@ -493,7 +493,7 @@ function sanitizeHtml(html, options, _recursing) {
});
}

if (options.selfClosing[name]) {
if (Object.hasOwn(options.selfClosing, name)) {
result += options.selfClosing[name]?.voidElement === true
? '>'
: ' />';
Expand Down

0 comments on commit c884bd4

Please sign in to comment.