class Capybara::Selector::CSS::Splitter

def split(css)

def split(css)
  selectors = []
  StringIO.open(css.to_s) do |str|
    selector = ''
    while (char = str.getc)
      case char
      when '['
        selector += parse_square(str)
      when '('
        selector += parse_paren(str)
      when '"', "'"
        selector += parse_string(char, str)
      when '\\'
        selector += char + str.getc
      when ','
        selectors << selector.strip
        selector = ''
      else
        selector += char
      end
    end
    selectors << selector.strip
  end
  selectors
end