sanitize-html icon indicating copy to clipboard operation
sanitize-html copied to clipboard

Add `preserveEscapedAttributes` option to retain all attributes of escaped disallowed tags

Open benelliott opened this issue 7 months ago • 1 comments

Fixes https://github.com/apostrophecms/sanitize-html/issues/540

Summary

Summarize the changes briefly, including which issue/ticket this resolves. If it closes an existing Github issue, include "Closes #[issue number]"

Add preserveEscapedAttributes option to allow attributes on escaped disallowed tags to be retained. Closes #540

What are the specific steps to test this change?

You can try the new behaviour by setting preserveEscapedAttributes to true when disallowedTagsMode is 'escape' or 'recursiveEscape'.

Added unit tests to PR.

What kind of change does this PR introduce?

(Check at least one)

  • [ ] Bug fix
  • [x] New feature
  • [ ] Refactor
  • [ ] Documentation
  • [ ] Build-related changes
  • [ ] Other

Make sure the PR fulfills these requirements:

  • [x] It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • [ ] The changelog is updated
  • [x] Related documentation has been updated
  • [x] Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

benelliott avatar Jul 08 '24 14:07 benelliott