-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
DocumentFragment#element_children doesn't return children (MRI) #1138
Comments
Prehaps even more clear, one would expect these to by symmetrical: def test_element_children
doc = Nokogiri::HTML::DocumentFragment.parse(" <div> </div>\n ")
assert doc.element_children.count == doc.children.select(:element?).count
end |
Thanks for reporting this, and for supplying a test case. I'll take a look! |
Note, it seems to affect |
It looks like a libxml2 bug or problem. The implementation for the I think this is an oversite, so I may work up a fix for them, and maybe we can backport. Grr. |
Patch proposed. We'll see how responsive they are. It's possible it isn't supported for some good reason that isn't apparent to me. |
I have a branch with a proposed patch and the above test, but I don't want to turn it into a pull request until I've heard from the libxml2 people. I don't know if there is some purposeful reason they left this functionality out. I'd hate to diverge Nokogiri's libxml2 from upstream. |
Upstream libxml2 has replied to the bug by applying the patch to head. #1144 should be safe to apply to Nokogiri now as it won't diverge from libxml2. |
Thanks for the investigation and the feedback to upstream. |
Yup. All done. I anticipate the 1.6.4 release! |
It appears to usually return zero even when elements are present. Failing test case on MRI (1.9.3-p484), passes on JRuby (1.7.11).
Given the recent change to whitespace handling in e593e96, element_children has become more important to handle only element Nodes.
The text was updated successfully, but these errors were encountered: