class Capybara::Selector::CSSBuilder
def attribute_conditions(attributes)
def attribute_conditions(attributes) attributes.map do |attribute, value| case value when XPath::Expression raise ArgumentError, "XPath expressions are not supported for the :#{attribute} filter with CSS based selectors" when Regexp Selector::RegexpDisassembler.new(value).substrings.map do |str| "[#{attribute}*='#{str}'#{' i' if value.casefold?}]" end.join when true "[#{attribute}]" when false ':not([attribute])' else if attribute == :id "##{::Capybara::Selector::CSS.escape(value)}" else "[#{attribute}='#{value}']" end end end.join end