sparklemotion/nokogiri — pull request #1033 by windwiny (2014-01-23 08:30:14+00:00)
Title: FIX: doc.root add omment or processinginstruction sibling

FIX: doc.root cann't add_next_sibling comment or processinginstruction

pi = Nokogiri::XML::ProcessingInstruction.new(doc, 'xml-xxx', 'yy="zz"')
comm = Nokogiri::XML::Comment.new(doc, 'xxx')

doc.root.add_previous_sibling(pi) # ok
doc.add_child(pi) # RuntimeError: Document already has a root node
doc.root.add_next_sibling(pi) # ArgumentError: A document may not have multiple root nodes

doc.root.add_previous_sibling(comm) # ArgumentError: A document may not have multiple root nodes
doc.root.add_next_sibling(comm) # ArgumentError: A document may not have multiple root nodes