From d91ec4572a0a5b5936627c5d85e08326f3b0a9bc Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Mon, 15 Oct 2018 13:51:17 -0700 Subject: [PATCH] require XPath 3.2+ and remove no longer necessary patches --- capybara.gemspec | 2 +- lib/capybara.rb | 1 - lib/capybara/xpath_patches.rb | 30 ------------------------------ 3 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 lib/capybara/xpath_patches.rb diff --git a/capybara.gemspec b/capybara.gemspec index f10cae0d..01977e0a 100644 --- a/capybara.gemspec +++ b/capybara.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('nokogiri', ['~> 1.8']) s.add_runtime_dependency('rack', ['>= 1.6.0']) s.add_runtime_dependency('rack-test', ['>= 0.6.3']) - s.add_runtime_dependency('xpath', ['~>3.1']) + s.add_runtime_dependency('xpath', ['~>3.2']) s.add_development_dependency('cucumber', ['>= 2.3.0']) s.add_development_dependency('erubi') # dependency specification needed by rbx diff --git a/lib/capybara.rb b/lib/capybara.rb index f187cde9..323b883e 100644 --- a/lib/capybara.rb +++ b/lib/capybara.rb @@ -414,7 +414,6 @@ module Capybara module RackTest; end module Selenium; end - require 'capybara/xpath_patches' require 'capybara/helpers' require 'capybara/session' require 'capybara/window' diff --git a/lib/capybara/xpath_patches.rb b/lib/capybara/xpath_patches.rb deleted file mode 100644 index a9ba22ed..00000000 --- a/lib/capybara/xpath_patches.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module XPath - module DSL - UPPERCASE_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞŸŽŠŒ' - LOWERCASE_LETTERS = 'abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿžšœ' - - def lowercase - method(:translate, UPPERCASE_LETTERS, LOWERCASE_LETTERS) - end - - def uppercase - method(:translate, LOWERCASE_LETTERS, UPPERCASE_LETTERS) - end - end -end - -module Capybara - module XPathPatches - module Renderer - def attribute(current, name) - return super if name =~ /^[a-zA-Z_:][a-zA-Z0-9_:\.\-]*$/ - - "#{current}/attribute::*[local-name(.) = #{string_literal(name)}]" - end - end - end -end - -XPath::Renderer.prepend(Capybara::XPathPatches::Renderer)