Sha256: 73283f57ad7408edc54ce512459894c7fddf56851e41aec323cf436a76d0617c

Contents?: true

Size: 733 Bytes

Versions: 46

Compression:

Stored size: 733 Bytes

Contents

module Watir
  class TableCell < HTMLElement
    # @private
    attr_writer :locator_class

    def locator_class
      @locator_class || super
    end

    def colspan
      value = attribute_value :colspan
      value ? Integer(value) : 1
    end
  end

  class TableCellCollection < ElementCollection
    attr_writer :locator_class

    def locator_class
      @locator_class || super
    end

    def elements
      # we do this craziness since the xpath used will find direct child rows
      # before any rows inside thead/tbody/tfoot...
      elements = super

      if locator_class == ChildCellLocator
        elements = elements.sort_by { |row| row.attribute(:cellIndex).to_i }
      end

      elements
    end

  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
watir-webdriver-0.1.4 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.1.3 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.1.2 lib/watir-webdriver/elements/table_cell.rb
ayanko-watir-webdriver-0.1.1.1 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.1.1 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.1.0 lib/watir-webdriver/elements/table_cell.rb