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.6.1 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.0 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.8 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.7 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.6 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.5 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.4 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.3 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.2 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.1 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.5.0 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.4.1 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.4.0 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.9 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.8 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.7 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.6 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.5 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.4 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.3.3 lib/watir-webdriver/elements/table_cell.rb