lib/capybara/selector/css.rb
module Capybara class Selector class CSS def self.escape(str) value = str.dup out = "".dup out << value.slice!(0...1) if value =~ /^[-_]/ out << (value[0] =~ NMSTART ? value.slice!(0...1) : escape_char(value.slice!(0...1))) out << value.gsub(/[^a-zA-Z0-9_-]/) { |c| escape_char c } out end def self.escape_char(c) c =~ %r{[ -/:-~]} ? "\\#{c}" : format("\\%06x", c.ord) end S = '\u{80}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}'.freeze H = /[0-9a-fA-F]/ UNICODE = /\\#{H}{1,6}[ \t\r\n\f]?/ NONASCII = /[#{S}]/ ESCAPE = /#{UNICODE}|\\[ -~#{S}]/ NMSTART = /[_a-zA-Z]|#{NONASCII}|#{ESCAPE}/ end end end
Source Files
- lib/capybara.rb
- lib/capybara/config.rb
- lib/capybara/cucumber.rb
- lib/capybara/driver/base.rb
- lib/capybara/driver/node.rb
- lib/capybara/dsl.rb
- lib/capybara/helpers.rb
- lib/capybara/minitest.rb
- lib/capybara/minitest/spec.rb
- lib/capybara/node/actions.rb
- lib/capybara/node/base.rb
- lib/capybara/node/document.rb
- lib/capybara/node/document_matchers.rb
- lib/capybara/node/element.rb
- lib/capybara/node/finders.rb
- lib/capybara/node/matchers.rb
- lib/capybara/node/simple.rb
- lib/capybara/queries/ancestor_query.rb
- lib/capybara/queries/base_query.rb
- lib/capybara/queries/current_path_query.rb
- lib/capybara/queries/match_query.rb
- lib/capybara/queries/selector_query.rb
- lib/capybara/queries/sibling_query.rb
- lib/capybara/queries/text_query.rb
- lib/capybara/queries/title_query.rb
- lib/capybara/rack_test/browser.rb
- lib/capybara/rack_test/css_handlers.rb
- lib/capybara/rack_test/driver.rb
- lib/capybara/rack_test/form.rb
- lib/capybara/rack_test/node.rb
- lib/capybara/rails.rb
- lib/capybara/result.rb
- lib/capybara/rspec.rb
- lib/capybara/rspec/compound.rb
- lib/capybara/rspec/features.rb
- lib/capybara/rspec/matcher_proxies.rb
- lib/capybara/rspec/matchers.rb
- lib/capybara/selector.rb
- lib/capybara/selector/css.rb
- lib/capybara/selector/filter.rb
- lib/capybara/selector/filter_set.rb
- lib/capybara/selector/filters/base.rb
- lib/capybara/selector/filters/expression_filter.rb
- lib/capybara/selector/filters/node_filter.rb
- lib/capybara/selector/selector.rb
- lib/capybara/selenium/driver.rb
- lib/capybara/selenium/node.rb
- lib/capybara/server.rb
- lib/capybara/session.rb
- lib/capybara/session/config.rb
- lib/capybara/session/matchers.rb
- lib/capybara/spec/session/accept_alert_spec.rb
- lib/capybara/spec/session/accept_confirm_spec.rb
- lib/capybara/spec/session/accept_prompt_spec.rb
- lib/capybara/spec/session/all_spec.rb
- lib/capybara/spec/session/ancestor_spec.rb
- lib/capybara/spec/session/assert_all_of_selectors_spec.rb
- lib/capybara/spec/session/assert_current_path.rb
- lib/capybara/spec/session/assert_selector.rb
- lib/capybara/spec/session/assert_text.rb
- lib/capybara/spec/session/assert_title.rb
- lib/capybara/spec/session/attach_file_spec.rb
- lib/capybara/spec/session/body_spec.rb
- lib/capybara/spec/session/check_spec.rb
- lib/capybara/spec/session/choose_spec.rb
- lib/capybara/spec/session/click_button_spec.rb
- lib/capybara/spec/session/click_link_or_button_spec.rb
- lib/capybara/spec/session/click_link_spec.rb
- lib/capybara/spec/session/current_scope_spec.rb
- lib/capybara/spec/session/current_url_spec.rb
- lib/capybara/spec/session/dismiss_confirm_spec.rb
- lib/capybara/spec/session/dismiss_prompt_spec.rb
- lib/capybara/spec/session/element/assert_match_selector.rb
- lib/capybara/spec/session/element/match_css_spec.rb
- lib/capybara/spec/session/element/match_xpath_spec.rb
- lib/capybara/spec/session/element/matches_selector_spec.rb
- lib/capybara/spec/session/evaluate_async_script_spec.rb
- lib/capybara/spec/session/evaluate_script_spec.rb
- lib/capybara/spec/session/execute_script_spec.rb
- lib/capybara/spec/session/fill_in_spec.rb
- lib/capybara/spec/session/find_button_spec.rb
- lib/capybara/spec/session/find_by_id_spec.rb
- lib/capybara/spec/session/find_field_spec.rb
- lib/capybara/spec/session/find_link_spec.rb
- lib/capybara/spec/session/find_spec.rb
- lib/capybara/spec/session/first_spec.rb
- lib/capybara/spec/session/frame/frame_title_spec.rb
- lib/capybara/spec/session/frame/frame_url_spec.rb
- lib/capybara/spec/session/frame/switch_to_frame_spec.rb
- lib/capybara/spec/session/frame/within_frame_spec.rb
- lib/capybara/spec/session/go_back_spec.rb
- lib/capybara/spec/session/go_forward_spec.rb
- lib/capybara/spec/session/has_all_selectors_spec.rb
- lib/capybara/spec/session/has_button_spec.rb
- lib/capybara/spec/session/has_css_spec.rb
- lib/capybara/spec/session/has_current_path_spec.rb
- lib/capybara/spec/session/has_field_spec.rb
- lib/capybara/spec/session/has_link_spec.rb
- lib/capybara/spec/session/has_none_selectors_spec.rb
- lib/capybara/spec/session/has_select_spec.rb
- lib/capybara/spec/session/has_selector_spec.rb
- lib/capybara/spec/session/has_table_spec.rb
- lib/capybara/spec/session/has_text_spec.rb
- lib/capybara/spec/session/has_title_spec.rb
- lib/capybara/spec/session/has_xpath_spec.rb
- lib/capybara/spec/session/headers.rb
- lib/capybara/spec/session/html_spec.rb
- lib/capybara/spec/session/node_spec.rb
- lib/capybara/spec/session/node_wrapper_spec.rb
- lib/capybara/spec/session/refresh_spec.rb
- lib/capybara/spec/session/reset_session_spec.rb
- lib/capybara/spec/session/response_code.rb
- lib/capybara/spec/session/save_and_open_page_spec.rb
- lib/capybara/spec/session/save_and_open_screenshot_spec.rb
- lib/capybara/spec/session/save_page_spec.rb
- lib/capybara/spec/session/save_screenshot_spec.rb
- lib/capybara/spec/session/screenshot_spec.rb
- lib/capybara/spec/session/select_spec.rb
- lib/capybara/spec/session/selectors_spec.rb
- lib/capybara/spec/session/sibling_spec.rb
- lib/capybara/spec/session/source_spec.rb
- lib/capybara/spec/session/text_spec.rb
- lib/capybara/spec/session/title_spec.rb
- lib/capybara/spec/session/uncheck_spec.rb
- lib/capybara/spec/session/unselect_spec.rb
- lib/capybara/spec/session/visit_spec.rb
- lib/capybara/spec/session/window/become_closed_spec.rb
- lib/capybara/spec/session/window/current_window_spec.rb
- lib/capybara/spec/session/window/open_new_window_spec.rb
- lib/capybara/spec/session/window/switch_to_window_spec.rb
- lib/capybara/spec/session/window/window_opened_by_spec.rb
- lib/capybara/spec/session/window/window_spec.rb
- lib/capybara/spec/session/window/windows_spec.rb
- lib/capybara/spec/session/window/within_window_spec.rb
- lib/capybara/spec/session/within_spec.rb
- lib/capybara/spec/spec_helper.rb
- lib/capybara/spec/test_app.rb
- lib/capybara/version.rb
- lib/capybara/window.rb