@api private
# File lib/selenium/webdriver/support/select.rb, line 272 def self.escape(str) if str.include?('"') && str.include?("'") parts = str.split('"', -1).map { |part| %Q{"#{part}"} } quoted = parts.join(%Q{, '"', }). gsub(/^"", |, ""$/, '') "concat(#{quoted})" elsif str.include?('"') # escape string with just a quote into being single quoted: f"oo -> 'f"oo' "'#{str}'" else # otherwise return the quoted string %Q{"#{str}"} end end