# File lib/nokogiri/xml/document_fragment.rb, line 10 def initialize document, tags = nil, ctx = nil return self unless tags children = if ctx # Fix for issue#490 if Nokogiri.jruby? ctx.parse("<root>#{tags}</root>").xpath("/root/node()") else ctx.parse(tags) end else XML::Document.parse("<root>#{tags}</root>") \ .xpath("/root/node()") end children.each { |child| child.parent = self } end