Class: Gammo::Parser::AfterBody
Overview
Instance Attribute Summary
#parser
Instance Method Summary
collapse
#initialize, #process
Instance Method Details
#character_token(token) ⇒ Object
11
12
13
14
|
# File 'lib/gammo/parser/insertion_mode/after_body.rb', line 11
def character_token(token)
s = token.data.lstrip
halt InBody.new(parser).process if s.length.zero?
end
|
31
32
33
34
35
36
37
38
|
# File 'lib/gammo/parser/insertion_mode/after_body.rb', line 31
def (token)
open_elements = parser.open_elements
if open_elements.length < 1 || open_elements.first.tag != Tags::Html
raise ParseError, 'bad parser state: <html> element not found, in the after-body insertion mode'
end
open_elements.first.append_child Node::Comment.new(data: token.data)
halt true
end
|
#default(_) ⇒ Object
40
41
42
43
|
# File 'lib/gammo/parser/insertion_mode/after_body.rb', line 40
def default(_)
parser.insertion_mode = InBody
halt false
end
|
#end_tag_token(token) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/gammo/parser/insertion_mode/after_body.rb', line 23
def end_tag_token(token)
case token.tag
when Tags::Html
parser.insertion_mode = AfterAfterBody unless parser.fragment?
halt true
end
end
|
#error_token(_) ⇒ Object
6
7
8
9
|
# File 'lib/gammo/parser/insertion_mode/after_body.rb', line 6
def error_token(_)
true
end
|
#start_tag_token(token) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/gammo/parser/insertion_mode/after_body.rb', line 16
def start_tag_token(token)
case token.tag
when Tags::Html
halt InBody.new(parser).process
end
end
|