Sha256: 3899f2ff39dd4982ef51e03eccd3cfa9f27c9496a563b5f9cc1e40f9167dc3fd

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

module Watir
  class TableCell < HTMLElement

    def column_header
      current_row = parent(tag_name: 'tr')
      header_row(current_row, index: previous_siblings.size)
    end

    def sibling_from_header(opt)
      current_row = parent(tag_name: 'tr')
      header = header_row(current_row, opt)
      index = header.previous_siblings.size

      self.class.new(current_row, tag_name: 'td', index: index)
    end

    private

    def header_row(current_row, opt)
      table = self.parent(tag_name: 'table')
      header_row = table.tr

      table.cell_size_check(header_row, current_row)

      header_type = table.th.exist? ? 'th' : 'tr'
      opt.merge!(tag_name: header_type)

      Watir.tag_to_class[header_type.to_sym].new(header_row, opt)
    end
  end # TableCell
end # Watir

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-6.7.1 lib/watir/elements/table_cell.rb
watir-6.7.0 lib/watir/elements/table_cell.rb