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

html5 subclassing #2534

Merged
merged 2 commits into from May 9, 2022
Merged

html5 subclassing #2534

merged 2 commits into from May 9, 2022

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

See #2331 for context. I want to start getting things in place to make it possible to seamlessly switch to HTML5 parsing by default on supported platform. Part of this will require subclassing behavior to work properly (i.e., as Loofah expects it to, where a subclass of Nokogiri::HTML5::Document will return the appropriate subclass from .parse).

This PR introduces that subclassing behavior, and makes all the HTML4 tests explicitly use HTML4 instead of HTML.

Note that Gumbo.parse now takes an additional argument, which is the class that should be used for the new document. Gumbo.parse is considered to be an internal-only API and so this shouldn't be a breaking change, but it might be worth mentioning in release notes just in case.

Have you included adequate test coverage?

Yes, additional coverage has been added to test/html5/test_api.rb

Does this change affect the behavior of either the C or the Java implementations?

HTML5 only exists in the CRuby implementation

This is long-term prep for a day when HTML5 may become the default on
supported platforms.
Loofah and other downstream libraries rely on this behavior. This is
long-term prep for a day when HTML5 may become the default on
supported platforms.
Copy link
Contributor

@stevecheckoway stevecheckoway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flavorjones flavorjones merged commit c39183a into main May 9, 2022
@flavorjones flavorjones deleted the 2331-html5-subclassing branch May 9, 2022 21:47
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