Class: HTML5::InTableBodyPhase

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

Instance Method Summary collapse

Methods inherited from Phase

#assert, end_tag_handlers, handle_end, handle_start, #in_scope?, #initialize, #processComment, #processDoctype, #processEndTag, #processSpaceCharacters, #processStartTag, #process_eof, #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



66
67
68
69
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 66

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

#endTagOther(name) ⇒ Object



71
72
73
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 71

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

#endTagTable(name) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 55

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
  end
end

#endTagTableRowGroup(name) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 44

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

#processCharacters(data) ⇒ Object



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

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

#startTagOther(name, attributes) ⇒ Object



40
41
42
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 40

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

#startTagTableCell(name, attributes) ⇒ Object



22
23
24
25
26
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 22

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



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 28

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
  end
end

#startTagTr(name, attributes) ⇒ Object



16
17
18
19
20
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb', line 16

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