Module: Taka::DOM::HTML::TableSectionElement

Defined in:
lib/taka/dom/html/table_section_element.rb

Instance Method Summary collapse

Instance Method Details

#chObject



40
41
42
# File 'lib/taka/dom/html/table_section_element.rb', line 40

def ch
  self['char']
end

#chOffObject



44
45
46
# File 'lib/taka/dom/html/table_section_element.rb', line 44

def chOff
  self['charoff']
end

#deleteRow(index) ⇒ Object



36
37
38
# File 'lib/taka/dom/html/table_section_element.rb', line 36

def deleteRow index
  (row = rows[index]) && row.unlink
end

#insertRow(index) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/taka/dom/html/table_section_element.rb', line 23

def insertRow index
  tr = Nokogiri::XML::Node.new('tr', self.document)

  sibling = rows[index]

  if !sibling
    self.add_child tr
  else
    sibling.add_previous_sibling tr
  end
  tr
end

#rowIndexObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/taka/dom/html/table_section_element.rb', line 5

def rowIndex
  parent_table = self.parent
  while parent_table.name != 'table'
    parent_table = parent_table.parent
  end

  parent_table.rows.each_with_index do |row, i|
    return i if row == self
  end
  raise
end

#rowsObject



17
18
19
20
21
# File 'lib/taka/dom/html/table_section_element.rb', line 17

def rows
  DOM::NodeList.new {
    xpath('./tr')
  }
end