Module: Watir::Locators::Element::SelectorBuilder::XpathSupport

Included in:
XPath
Defined in:
lib/watir/locators/element/selector_builder/xpath_support.rb

Constant Summary collapse

UPPERCASE_LETTERS =
'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞŸŽŠŒ'.freeze
LOWERCASE_LETTERS =
'abcdefghijklmnopqrstuvwxyzàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿžšœ'.freeze

Class Method Summary collapse

Class Method Details

.downcase(value) ⇒ Object


20
21
22
# File 'lib/watir/locators/element/selector_builder/xpath_support.rb', line 20

def self.downcase(value)
  "translate(#{value},'#{UPPERCASE_LETTERS}','#{LOWERCASE_LETTERS}')"
end

.escape(value) ⇒ Object


9
10
11
12
13
14
15
16
17
18
# File 'lib/watir/locators/element/selector_builder/xpath_support.rb', line 9

def self.escape(value)
  if value.include? "'"
    parts = value.split("'", -1).map { |part| "'#{part}'" }
    string = parts.join(%(,"'",))

    "concat(#{string})"
  else
    "'#{value}'"
  end
end