-
Notifications
You must be signed in to change notification settings - Fork 142
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
Recent change breaks transformers that modify DOM #177
Labels
Comments
Thank you for catching that @zetter. I wasn't aware people use transformers to change node names, |
stanhu
added a commit
to stanhu/sanitize
that referenced
this issue
Jul 24, 2018
In 4.6.2, rgrove#175 significantly cut down on memory usage by caching the lowercase version of the node name. However, as reported in rgrove#177, this broke certain transformers that modified the node name since the name was cached. We can bring back this optimization by updating the node name only if it has been changed. Closes rgrove#184
stanhu
added a commit
to stanhu/sanitize
that referenced
this issue
Jul 24, 2018
In 4.6.2, rgrove#175 significantly cut down on memory usage by caching the lowercase version of the node name. However, as reported in rgrove#177, this broke certain transformers that modified the node name since the name was cached. We can bring back this optimization by updating the node name only if it has been changed. Closes rgrove#184
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the quick release of
4.6.3
to fix the vulnerability.I upgraded the sanitize gem on a project I'm working on and found that an integration test was failing. I tracked down the cause of the break to a
4.6.2
change to optimize the memory usage of sanitize.Previously transformers could make changes to the DOM and other transformers would work on the updated DOM. One of the changes to optimize memory usage caches the name of the DOM node between transformers so this is no longer the case.
I've provided a test case and possible fix by removing this particular memory optimization.
My project's use case is similar to the test- using transformers to change the name of a HTML tag. I was worried that we might be using sanitize in an unusual and unsupported way, but looking at the readme it sounds like this is an expected use of transformers:
If you think the way the transformer is written is surprising and there is a better way, please let me know.
Thanks for your time
The text was updated successfully, but these errors were encountered: