-
-
Notifications
You must be signed in to change notification settings - Fork 905
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#search and #xpath #370
Comments
I've implemented search w/ tests. However, things get weird with xpath. I emailed the list about that. Once that is worked out on the list, I'll submit the fixes for this plus for the bug that the fragment search uncovered. |
a couple of tests are missing... test_fragment_css and test_fragment_search dont check for depth searches of children. will add tests for those. |
should this apply to xpaths? if i ask for xpath search current node then searching children is wrong as it would be out of context. that would be an issue for search if it is an xpath. |
Sean Allen said on the mailing list: I'm underway on this ( aka issue 370 ) and stumbled across something else I think might be a bug that is getting in the way of xpath support working. I dont think this is issue 357 but might be related in some fashion.
Is this a libxml bug? more xpath weirdness...
|
Hi Sean, I appreciate your work on this issue! If I don't get back to you right away, it's because I have a day job, not because I don't care. :) There are definite weirdnesses going on. I need to track them down. If you want to continue working, please feel free, but understand that I can't give you good guidance without understanding the root issue, and if I understood that I'd fix it. :) :) I will be working on this. |
I've gotten at least as far as knowing that the 'more xpath weirdness' is XPathContext related in some fashion but haven't gotten into the libxml code to try and see why... small demonstration in this gist ( I am incapable of using gh markdown for some reason ): |
Follow up question... I have search for css which was my primary immediate concern.. I'm also going to need xpath support soon, so I'll keep banging away at that although I might be a little slow as I'm not real familiar with the code at this point ( but I am way more familiar than I was 24-48 hours ago ). |
If you need something immediately, my recommendation would be to monkeypatch NokogirI::XML::DocumentFragment with your current fix. Please feel free to send pull requests. |
Another strange behavior that seems somewhat related:
DocumentFragment should probably have the same basic behavior as an element node when it contains text, yeah? |
@rtomayko - Yes, definitely related. You can work around by using more specific xpath:
|
Folding this into #572, the underlying issue is the same. |
DocumentFragment#search and #xpath should work properly. The current 'test_fragment_search' should be replaced with the following test cases:
note that #331 and #357 might be related.
The text was updated successfully, but these errors were encountered: