Skip to content

Commit

Permalink
Remove deprecated fallback allowDangerousHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed May 1, 2021
1 parent 3cc3cb6 commit 6698927
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
3 changes: 1 addition & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export function toHtml(node, options = {}) {
tightLists: options.tightCommaSeparatedLists,
tightClose: options.tightSelfClosing,
collapseEmpty: options.collapseEmptyAttributes,
// @ts-ignore `allowDangerousHTML` is deprecated.
dangerous: options.allowDangerousHtml || options.allowDangerousHTML,
dangerous: options.allowDangerousHtml,
voids: options.voids || htmlVoidElements.concat(),
entities: options.entities || {},
close: options.closeSelfClosing,
Expand Down
17 changes: 0 additions & 17 deletions test/raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,5 @@ test('`element`', function (t) {
'should not encode `raw`s in `allowDangerousHtml` mode'
)

t.deepEqual(
// @ts-ignore nonstandard.
toHtml(u('raw', '<script>alert("XSS!")</script>'), {
allowDangerousHTML: true
}),
'<script>alert("XSS!")</script>',
'should support the legacy `allowDangerousHTML` (#1)'
)
t.deepEqual(
// @ts-ignore nonstandard.
toHtml(u('raw', '<script>alert("XSS!")</script>'), {
allowDangerousHTML: true
}),
'<script>alert("XSS!")</script>',
'should support the legacy `allowDangerousHTML` (#2)'
)

t.end()
})

0 comments on commit 6698927

Please sign in to comment.