class Gammo::Parser::InColumnGroup

Section 12.2.6.4.12.

Public Instance Methods

comment_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 15
def comment_token(token)
  parser.add_child(Node::Comment.new(data: token.data))
  halt true
end
default(_) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 58
def default(_)
  halt true if parser.top.tag != Tags::Colgroup
  parser.open_elements.pop
  parser.insertion_mode = InTable
  halt false
end
doctype_token(_) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 20
def doctype_token(_)
  halt true
end
end_tag_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 38
def end_tag_token(token)
  case token.tag
  when Tags::Colgroup
    if parser.top.tag == Tags::Colgroup
      parser.open_elements.pop
      parser.insertion_mode = InTable
    end
    halt true
  when Tags::Col
    # ignore the token
    halt true
  when Tags::Template
    halt InHead.new(parser).process
  end
end
error_token(_) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 54
def error_token(_)
  halt InBody.new(parser).process
end
start_tag_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 24
def start_tag_token(token)
  case token.tag
  when Tags::Html
    halt InBody.new(parser).process
  when Tags::Col
    parser.add_element
    parser.open_elements.pop
    parser.acknowledge_self_closing_tag
    halt true
  when Tags::Template
    halt InHead.new(parser).process
  end
end
text_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/in_column_group.rb, line 5
def text_token(token)
  s = token.data.lstrip
  if s.length < token.data.length
    # add the initial whitespace to the current node.
    parser.add_text token.data.slice(0, token.data.length - s.length)
    halt true if s == ''
    token.data = s
  end
end