Class: HTML5::RootElementPhase

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

Direct Known Subclasses

XhmlRootPhase

Instance Method Summary collapse

Methods inherited from Phase

#assert, end_tag_handlers, handle_end, handle_start, #in_scope?, #initialize, #processDoctype, #remove_open_elements_until, #startTagHtml, start_tag_handlers, tag_handlers

Constructor Details

This class inherits a constructor from HTML5::Phase

Instance Method Details

#insert_html_elementObject



34
35
36
37
38
39
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb', line 34

def insert_html_element
  element = @tree.createElement('html', {})
  @tree.open_elements << element
  @tree.document.appendChild(element)
  @parser.phase = @parser.phases[:beforeHead]
end

#process_eofObject



6
7
8
9
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb', line 6

def process_eof
  insert_html_element
  @parser.phase.process_eof
end

#processCharacters(data) ⇒ Object



18
19
20
21
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb', line 18

def processCharacters(data)
  insert_html_element
  @parser.phase.processCharacters(data)
end

#processComment(data) ⇒ Object



11
12
13
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb', line 11

def processComment(data)
  @tree.insert_comment(data, @tree.document)
end

#processEndTag(name) ⇒ Object



29
30
31
32
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb', line 29

def processEndTag(name)
  insert_html_element
  @parser.phase.processEndTag(name)
end

#processSpaceCharacters(data) ⇒ Object



15
16
# File 'lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb', line 15

def processSpaceCharacters(data)
end

#processStartTag(name, attributes) ⇒ Object



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

def processStartTag(name, attributes)
  @parser.first_start_tag = true if name == 'html'
  insert_html_element
  @parser.phase.processStartTag(name, attributes)
end