module Nokogiri module HTML class DocumentFragment < Nokogiri::XML::DocumentFragment attr_accessor :errors #### # Create a Nokogiri::XML::DocumentFragment from +tags+, using +encoding+ def self.parse tags, encoding = nil doc = HTML::Document.new encoding ||= tags.respond_to?(:encoding) ? tags.encoding.name : 'UTF-8' doc.encoding = encoding new(doc, tags) end def initialize document, tags = nil, ctx = nil return self unless tags if ctx preexisting_errors = document.errors.dup node_set = ctx.parse("