Skip to content

update tests to support Loofah in HTML5 parsing mode #133

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

Closed
wants to merge 2 commits into from

Conversation

flavorjones
Copy link
Member

flavorjones/loofah#239 proposes to change Loofah's behavior to use the libgumbo HTML5 parser (Nokogiri::HTML5) instead of libxml2's HTML4 parser (Nokogiri::HTML4).

This branch updates the rails-html-sanitizer test suite to support either mode, and illustrates some of the typical changes in sanitized output.

I don't think any of the sanitization changes should be considered "breaking", and that's partly the point of this exercise -- to build confidence that swapping out Loofah's parser is not an unreasonable thing to do. But I'd love to hear from other folks.

Note that Loofah provides an escape hatch which is to set the
environment variable LOOFAH_HTML4_MODE to return to the previous
behavior.

CI tests both html4 and html5 modes
@flavorjones
Copy link
Member Author

Closing this, will shortly open a new PR that allows HTML5 parsing to be opted into, and which will support a Rails config to make HTML5 the default in a future release of Rails.

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.

1 participant