Skip to content

Commit

Permalink
fix(jruby): XML::DocumentFragment.dup to another document (v1.17.x) (#…
Browse files Browse the repository at this point in the history
…3373)

Backport of #3372
  • Loading branch information
flavorjones authored Dec 12, 2024
2 parents e4bae8a + 8bd6c6d commit ffaa44c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ext/java/nokogiri/XmlNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,11 @@ public class XmlNode extends RubyObject

@JRubyMethod(visibility = Visibility.PROTECTED)
public IRubyObject
initialize_copy_with_args(ThreadContext context, IRubyObject other, IRubyObject level, IRubyObject _ignored)
initialize_copy_with_args(ThreadContext context, IRubyObject other, IRubyObject level, IRubyObject document)
{
boolean deep = level instanceof RubyInteger && RubyFixnum.fix2int(level) != 0;
this.node = asXmlNode(context, other).node.cloneNode(deep);
setDocument(context, (XmlDocument)document);
return this;
}

Expand Down
2 changes: 0 additions & 2 deletions test/xml/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ def test_dup_same_parent_document_is_default
end

def test_dup_different_parent_document
skip_unless_libxml2("Node.dup with new_parent arg is only implemented on CRuby")

doc1 = XML::Document.parse("<root><div><p>hello</p></div></root>")
doc2 = XML::Document.parse("<div></div>")

Expand Down

0 comments on commit ffaa44c

Please sign in to comment.