Sha256: 56c876fe69cc13d6d13dedfbe05c985cd9c2c74d8a224d7ad7f4f3ce0aaeb93a

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

module Loofah
  module HTML
    #
    #  Subclass of Nokogiri::HTML::DocumentFragment. Also includes Loofah::ScrubberInstanceMethods.
    #
    #  See Loofah::ScrubberInstanceMethods for additional methods.
    #
    class DocumentFragment < Nokogiri::HTML::DocumentFragment
      include Loofah::ScrubberInstanceMethods

      class << self
        #
        #  Overridden Nokogiri::HTML::DocumentFragment
        #  constructor. Applications should use Loofah.fragment to
        #  parse a fragment.
        #
        def parse tags
          self.new(Loofah::HTML::Document.new, tags)
        end
      end

      private

      def __sanitize_roots # :nodoc:
        xpath("./body").first || self
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
loofah-0.3.0 lib/loofah/html/document_fragment.rb
loofah-0.2.2 lib/loofah/html/document_fragment.rb
loofah-0.2.1 lib/loofah/html/document_fragment.rb
loofah-0.2.0 lib/loofah/html/document_fragment.rb