Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TAG and ATTR cfg options case-sensitive when parsing XHTML #692

Merged
merged 1 commit into from Jun 6, 2022

Conversation

tosmolka
Copy link
Contributor

@tosmolka tosmolka commented Jun 6, 2022

Summary

A while back we introduced PARSER_MEDIA_TYPE option for parsing XHTML files where tag and attribute names are case-sensitive.

We have one use case where we would like DOMPurify to keep certain custom tags and attributes by specifying ALLOWED_TAGS and ALLOWED_ATTR options. The problem is that addToSet function forces lowercase by calling stringToLowerCase on all elements. DOMPurify therefore does not respect ALLOWED_TAGS and ALLOWED_ATTR options and always removes our custom tags and attributes.

This PR fixes this issue by passing transformCaseFunc to addToSet, happy to redo if there is a better way to do it.

@cure53
Copy link
Owner

cure53 commented Jun 6, 2022

This looks great, thank you!

@cure53 cure53 merged commit 79e622c into cure53:main Jun 6, 2022
cure53 added a commit that referenced this pull request Jun 6, 2022
fix: disable colliding linter rule
cure53 added a commit that referenced this pull request Jun 6, 2022
test: Fixed a test in Edge 17
@tosmolka
Copy link
Contributor Author

@cure53 , do you have a release date for this change? Thanks.

@cure53
Copy link
Owner

cure53 commented Jul 11, 2022

Why not now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants