Closed senny closed 10 months ago
@stadelmanma let me know if you have any thoughts in this. I have been away from the code base a bit too long to know the right resolution without digging into all the details again.
Hey @senny I recall running into a problem when trying to upgrade nokogiri awhile back but couldn't get it resolved. Unfortnately I've been away from this code for awhile now as well.
@stadelmanma thanks for the heads up, completely understandable.
I'll see if I can manage to set aside some time to investigate this subject.
Did some digging and this error was introduced in Nokogiri 1.11.0
. https://nokogiri.org/CHANGELOG.html#notes_1 due to changes around the node methods when there is no parent node found. Specifically add_next_sibiling
is called and raises RuntimeError: Cannot add sibling to a node with no parent
.
Is this just a test-suite issue, or is this a problem with the library that needs to be fixed? I don't know enough about the internals and how it is using nokogiri to even guess.
The nokogiri changelog describes why this changed:
The Node methods add_previous_sibling, previous=, before, add_next_sibling, next=, after, replace, and swap now correctly use their parent as the context node for parsing markup. These methods now also raise a RuntimeError if they are called on a node with no parent. [[nokogumbo#160](https://github.com/rubys/nokogumbo/issues/160)]
Finished by #188
Tried to upgrade Nokogiri but ended up with a test error that I'm not completely sure how to resolve:
The test that fails looks like this: https://github.com/senny/sablon/blob/883de2ecb8c0e8fe92b549ca654f444160f67561/test/content_test.rb#L197-L217
The part where it's failing like this: https://github.com/senny/sablon/blob/883de2ecb8c0e8fe92b549ca654f444160f67561/lib/sablon/content.rb#L132-L139
I suspect that this is related to the
.remove
here: https://github.com/senny/sablon/blob/883de2ecb8c0e8fe92b549ca654f444160f67561/lib/sablon/content.rb#L89