Sha256: 9a132bf4633f647ca562ee4b28b61e478f7f436435a61dbf995f4087097c36a9

Contents?: true

Size: 775 Bytes

Versions: 8

Compression:

Stored size: 775 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 # TableCell

  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 # TableCellCollection
end # Watir

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
watir-webdriver-0.6.9 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.8 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.7 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.6 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.5 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.4 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.3 lib/watir-webdriver/elements/table_cell.rb
watir-webdriver-0.6.2 lib/watir-webdriver/elements/table_cell.rb