Skip to content

Commit

Permalink
Allow the "checked" attribute on inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecoble committed Jul 3, 2024
1 parent 7183685 commit e9007d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/parseMarkdown.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const SANITIZE_HTML_OPTIONS: IOptions = {
"mozallowfullscreen",
],
img: ["src", "alt", "width", "height", "caption", "cite"],
input: ["type", "name", "value"],
input: ["type", "name", "value", "checked"],
script: ["src", "type", "async", "charset"],
ol: ["start"],
table: ["border", "cellpadding", "cellspacing"],
Expand Down
10 changes: 10 additions & 0 deletions src/lib/parseMarkdown.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,14 @@ describe("body", () => {

expect(r).toEqual("<p>foo</p>\n");
});

it("allows inputs to have the \"checked\" attribute", () => {
const r = parseMarkdown(
ether({
content: "<input type=\"checkbox\" checked />"
}),
);

expect(r).toContain("<input type=\"checkbox\" checked />");
});
});

0 comments on commit e9007d1

Please sign in to comment.