lib/hatemile/implementation/accessible_association_implementation.rb
##
# Associate the data cell with header cell of row.
#
# @param element [Hatemile::Util::Html::HTMLDOMElement] The table body or
#   table footer.
# @return [void]
Associate the data cell with header cell of row.
Associate the data cell with header cell of row .
def associate_data_cells_with_header_cells_of_row(element)
        table = get_model_table(element)
        headers_ids = []
        table.each do |row|
          headers_ids.clear
          row.each do |cell|
            next unless cell.get_tag_name == 'TH' &&
                        Hatemile::Util::CommonFunctions.is_valid_element?(cell)
            @id_generator.generate_id(cell)
            headers_ids.push(cell.get_attribute('id'))
            cell.set_attribute('scope', 'row')
          end
          next if headers_ids.empty?
          row.each do |cell|
            next unless cell.get_tag_name == 'TD' &&
                        Hatemile::Util::CommonFunctions.is_valid_element?(cell)
            headers = cell.get_attribute('headers')
            headers_ids.each do |header_id|
              headers = Hatemile::Util::CommonFunctions.increase_in_list(
                headers,
                header_id
              )
            end
            cell.set_attribute('headers', headers)
          end
        end
      end
def associate_data_cells_with_header_cells_of_row ( element ) table = get_model_table ( element ) headers_ids = [ ] table . each do | row | headers_ids . clear row . each do | cell | next unless cell . get_tag_name == 'TH' && Hatemile :: Util :: CommonFunctions . is_valid_element? ( cell ) @id_generator . generate_id ( cell ) headers_ids . push ( cell . get_attribute ( 'id' ) ) cell . set_attribute ( 'scope' , 'row' ) end next if headers_ids . empty? row . each do | cell | next unless cell . get_tag_name == 'TD' && Hatemile :: Util :: CommonFunctions . is_valid_element? ( cell ) headers = cell . get_attribute ( 'headers' ) headers_ids . each do | header_id | headers = Hatemile :: Util :: CommonFunctions . increase_in_list ( headers , header_id ) end cell . set_attribute ( 'headers' , headers ) end end end
Associate the data cell with header cell of row.
Associate the data cell with header cell of row .
None
void
element
The table body or table footer.
The table body or table footer .