    # File lib/nokogiri/xml/node.rb, line 395
          def replace node_or_tags
            node_or_tags = coerce(node_or_tags)
            if node_or_tags.is_a?(XML::NodeSet)
              if text?
                replacee = Nokogiri::XML::Node.new 'dummy', document
                add_previous_sibling_node replacee
                unlink
              else
                replacee = self
              end
              node_or_tags.each { |n| replacee.add_previous_sibling n }
              replacee.unlink
            else
              replace_node node_or_tags
            end
            node_or_tags
          end