Class: HTML5::InCellPhase

Inherits:
Phase
  • Object
show all
Defined in:
lib/html5/html5parser/in_cell_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, #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



49
50
51
# File 'lib/html5/html5parser/in_cell_phase.rb', line 49

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

#endTagImply(name) ⇒ Object



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

def endTagImply(name)
  if in_scope?(name, true)
    closeCell
    @parser.phase.processEndTag(name)
  else
    # sometimes inner_html case
    parse_error "unexpected-end-tag", {:name => name}
  end
end

#endTagOther(name) ⇒ Object



63
64
65
# File 'lib/html5/html5parser/in_cell_phase.rb', line 63

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

#endTagTableCell(name) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/html5/html5parser/in_cell_phase.rb', line 32

def endTagTableCell(name)
  if in_scope?(name, true)
    @tree.generateImpliedEndTags(name)
    if @tree.open_elements.last.name != name
      parse_error("unexpected-cell-end-tag", {"name" => name})

      remove_open_elements_until(name)
    else
      @tree.open_elements.pop
    end
    @tree.clearActiveFormattingElements
    @parser.phase = @parser.phases[:inRow]
  else
    parse_error("unexpected-end-tag", {"name" => name})
  end
end

#processCharacters(data) ⇒ Object



14
15
16
# File 'lib/html5/html5parser/in_cell_phase.rb', line 14

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

#startTagOther(name, attributes) ⇒ Object



28
29
30
# File 'lib/html5/html5parser/in_cell_phase.rb', line 28

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

#startTagTableOther(name, attributes) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/html5/html5parser/in_cell_phase.rb', line 18

def startTagTableOther(name, attributes)
  if in_scope?('td', true) or in_scope?('th', true)
    closeCell
    @parser.phase.processStartTag(name, attributes)
  else
    # inner_html case
    parse_error
  end
end