Class: HTML5::InTableBodyPhase

Inherits:
Phase
  • Object
show all
Defined in:
lib/html5/html5parser/in_table_body_phase.rb

Instance Method Summary collapse

Methods inherited from Phase

#adjust_foreign_attributes, #adjust_mathml_attributes, #assert, end_tag_handlers, handle_end, handle_start, #in_scope?, #initialize, #processComment, #processDoctype, #processEndTag, #processStartTag, #remove_open_elements_until, #startTagHtml, start_tag_handlers, tag_handlers

Constructor Details

This class inherits a constructor from HTML5::Phase

Instance Method Details

#endTagIgnore(name) ⇒ Object



73
74
75
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 73

def endTagIgnore(name)
  parse_error("unexpected-end-tag-in-table-body", {"name" => name})
end

#endTagOther(name) ⇒ Object



77
78
79
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 77

def endTagOther(name)
  @parser.phases[:inTable].processEndTag(name)
end

#endTagTable(name) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 62

def endTagTable(name)
  if in_scope?('tbody', true) or in_scope?('thead', true) or in_scope?('tfoot', true)
    clearStackToTableBodyContext
    endTagTableRowGroup(@tree.open_elements.last.name)
    @parser.phase.processEndTag(name)
  else
    # inner_html case
    parse_error "unexpected-end-tag", {:name => name}
  end
end

#endTagTableRowGroup(name) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 52

def endTagTableRowGroup(name)
  if in_scope?(name, true)
    clearStackToTableBodyContext
    @tree.open_elements.pop
    @parser.phase = @parser.phases[:inTable]
  else
    parse_error("unexpected-end-tag-in-table-body", {"name" => name})
  end
end

#process_eofObject



20
21
22
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 20

def process_eof
  @parser.phases[:inTable].process_eof
end

#processCharacters(data) ⇒ Object



12
13
14
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 12

def processCharacters(data)
  @parser.phases[:inTable].processCharacters(data)
end

#processSpaceCharacters(data) ⇒ Object



16
17
18
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 16

def processSpaceCharacters(data)
  @parser.phases[:inTable].processSpaceCharacters(data)
end

#startTagOther(name, attributes) ⇒ Object



48
49
50
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 48

def startTagOther(name, attributes)
  @parser.phases[:inTable].processStartTag(name, attributes)
end

#startTagTableCell(name, attributes) ⇒ Object



30
31
32
33
34
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 30

def startTagTableCell(name, attributes)
  parse_error("unexpected-cell-in-table-body", {"name" => name})
  startTagTr('tr', {})
  @parser.phase.processStartTag(name, attributes)
end

#startTagTableOther(name, attributes) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 36

def startTagTableOther(name, attributes)
  # XXX AT Any ideas on how to share this with endTagTable?
  if in_scope?('tbody', true) or in_scope?('thead', true) or in_scope?('tfoot', true)
    clearStackToTableBodyContext
    endTagTableRowGroup(@tree.open_elements.last.name)
    @parser.phase.processStartTag(name, attributes)
  else
    # inner_html case
    parse_error "unexpected-start-tag", {:name => name}
  end
end

#startTagTr(name, attributes) ⇒ Object



24
25
26
27
28
# File 'lib/html5/html5parser/in_table_body_phase.rb', line 24

def startTagTr(name, attributes)
  clearStackToTableBodyContext
  @tree.insert_element(name, attributes)
  @parser.phase = @parser.phases[:inRow]
end