-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
#text
should only render HTML elements
#221
Comments
@weiqingtoh Thanks for asking this question! I think this is a bug in Loofah's implementation of html_frag = "<style> some css</style> <!-- some HTML comment --><p> some text</p>"
Nokogiri::HTML::DocumentFragment.parse(html_frag).text
=> " some css some text"
Loofah.fragment(html_frag).text
=> " some css some HTML comment some text" Nokogiri uses a libxml2 function to serialize. Loofah overrides this method but is including all children, not just visible elements. I'll work on a fix! |
flavorjones
changed the title
Should
Dec 8, 2021
#text
render text with non-visible HTML tags#text
should only render HTML elements
flavorjones
added a commit
that referenced
this issue
Dec 10, 2021
Previously any comment nodes that were top-level children of the fragment were serialized. Closes #221
flavorjones
added a commit
that referenced
this issue
Dec 10, 2021
Previously any comment nodes that were top-level children of the fragment were serialized. Closes #221
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure if this is an issue, but a question here - is it intended for
#text
to show text within non visible HTML tags? It seems like we are still displaying for<style>
tags as well as HTML comment tags<!-- Some text>
.Thank you!
The text was updated successfully, but these errors were encountered: