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

Class Method Summary collapse

Class Method Details

.downcase(value) ⇒ Object



22
23
24
# File 'lib/watir/locators/element/selector_builder/xpath_support.rb', line 22

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

.escape(value) ⇒ Object



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

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

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