class Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector

def extract_root(previous_selection, root_fallback)

def extract_root(previous_selection, root_fallback)
  possible_root = @values.first
  if possible_root == nil
    raise ArgumentError, "First argument is either selector or element " \
      "to select, but nil found. Perhaps you called assert_dom with " \
      "an element that does not exist?"
  elsif possible_root.respond_to?(:css)
    @values.shift # remove the root, so selector is the first argument
    possible_root
  elsif previous_selection
    previous_selection
  else
    root_fallback.call
  end
end