module Loofah::HtmlFragmentBehavior::ClassMethods

def document_klass

def document_klass
  @document_klass ||= if Loofah.html5_support? && self == Loofah::HTML5::DocumentFragment
    Loofah::HTML5::Document
  elsif self == Loofah::HTML4::DocumentFragment
    Loofah::HTML4::Document
  else
    raise ArgumentError, "unexpected class: #{self}"
  end
end