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

Allow replaceWithChildrenElements together with elements #261

Open
evilpie opened this issue Feb 28, 2025 · 0 comments
Open

Allow replaceWithChildrenElements together with elements #261

evilpie opened this issue Feb 28, 2025 · 0 comments
Labels
sanitizer-algorithm issue with the algorithm

Comments

@evilpie
Copy link

evilpie commented Feb 28, 2025

For a config like this: {elements: ["em"], replaceWithChildrenElements: ["div"]} and the following HTML <div><em>Apple<em></div>, I would expect the result to be <em>Apple</em>.

However, currently sanitize-core first removes all elements not contained in "elements" (Step 2.4.2.) and then handles "replaceWithChildrenElements" (Step 2.4.3.). I propose we swap these two steps.

(We already disallow having the same element in both elements and replaceWithChildrenElements)

@annevk annevk added the sanitizer-algorithm issue with the algorithm label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sanitizer-algorithm issue with the algorithm
Projects
None yet
Development

No branches or pull requests

2 participants