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

Use body as the context element for Document#fragment #2553

Merged
merged 2 commits into from
Jul 20, 2022
Merged

Use body as the context element for Document#fragment #2553

merged 2 commits into from
Jul 20, 2022

Conversation

stevecheckoway
Copy link
Contributor

@stevecheckoway stevecheckoway commented May 20, 2022

What problem is this PR intended to solve?

Fixes: #2551

Have you included adequate test coverage?

Yes.

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

It changes the C HTML5 visible behavior (but not implementation) to match the C HTML4 implementation. I don't know what the Java implementation does.

@flavorjones flavorjones added this to the v1.14.0 milestone Jun 6, 2022
@stevecheckoway stevecheckoway marked this pull request as ready for review July 16, 2022 04:58
stevecheckoway and others added 2 commits July 19, 2022 16:53
This aligns with the behavior for the HTML 4 parser.

Fixes: #2551
also make the tests a bit more self-explanatory
@flavorjones
Copy link
Member

I rebased and added a bit of documentation to HTML5::Document#fragment while I had context (no pun intended).

Should go green, I'll merge after that.

# Nokogiri::HTML5::DocumentFragment. This object's children will be empty if `markup` is not passed, is empty, or is `nil`.
#
def fragment(markup = nil)
DocumentFragment.new(self, markup)
Copy link
Member

Choose a reason for hiding this comment

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

Note that I changed this line to not pass in the third argument, rather than pass in an explicit nil.

@flavorjones flavorjones merged commit 1b13414 into sparklemotion:main Jul 20, 2022
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.

[bug] HTML5 fragment has extraneous head/body tags
2 participants