-
-
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
Add an options parameter to all the methods that allow creation of an HTML document fragment #1692
Add an options parameter to all the methods that allow creation of an HTML document fragment #1692
Conversation
There are failing tests here related to the jruby implementation that will need to be addressed. I would like test coverage for this, yes, to ensure we're exercising this code path. Not sure which parse option to test with; maybe NOENT or NOERROR would be good candidates? |
Thanks for the prompt response @flavorjones! I ran the tests locally, but I guess it only runs the plain Ruby implementation. Was just writing the Ruby test now. I'll look at the Java tests too :) |
So after looking at this a bit, it turns out that there's a difference in the behaviour of the Java and C implementations. When instantiating a XmlDocumentFragment, the C implementation yields the provided block with an argument of itself (see https://github.com/JackMc/nokogiri/blob/058f5700fbff4b264b4727da484bfc419db1eb32/ext/nokogiri/xml_document_fragment.c#L28), whereas the Java implementation does not. This is causing trouble when using MRI and This is not documented or tested and is used internally in one place as far as we can tell (d18f1ac#diff-8b98857b6a2cb5117b8b1de836357ecdR59). I'd argue that it would be best to rewrite this one usage so the block parameter can be freed up for this purpose (bringing it in line with @flavorjones what do you think? |
Actually, it looks like that previous use is only for Node, so it doesn't seem to be used anywhere. |
Bump :) This is mostly done I think. The tests that are failing here match the tests that are failing on master. |
4ba8b4a
to
d2a7947
Compare
Bump :) I've rebased upon master now so this should be easier to review |
Bump :) |
Sorry for the terrible response time on this. I'd like to get this into v1.9.0, and so I'm going to rebase these commits and submit a separate PR to make sure they pass CI. I'll continue any conversation that needs to happen here, but will link to the other branch for visibility. |
Rebase went green at #1843. I noticed the test added for this, |
Ok - so this changeset doesn't actually work in the JRuby implementation, and so it's not going to make it into v1.9.0. It's also becoming apparent, as I added test coverage, that the JRuby implementation has some other pre-existing warts that I need to fix. Here's how I'd like to approach:
I'm going to open a new issue, linking to this one, to track all the additional work. I'll make sure your commit appears in master so you get contributor credit. Changing target milestone to v1.10.0 |
See #1844 for progress on this work. |
Please note that the latest CI failure is a problem with the new PR pipeline and not an issue with this PR, which previously was green. Still targetting for v1.11.0. |
Similar to Document constructors, we can now pass in parse options as a parameter or via a config block. Fixes #1692 Fixes #1844 Co-authored-by: Jack McCracken <[email protected]>
See #2399 for an updated version of this branch. |
Similar to Document constructors, we can now pass in parse options as a parameter or via a config block. Fixes #1692 Fixes #1844 Co-authored-by: Jack McCracken <[email protected]>
Will ship in v1.13.0 ... thanks for your patience! |
We are facing an issue where we cannot provide a DocumentFragment with the
XML::ParseOptions::HUGE
option because it doesn't take theoptions
int like the regularDocument
class does. This adds an optional parameter for passing that down.Let me know if there need to be extra tests to ensure this is working :-)