class Gammo::Parser::Text

Section 12.2.6.4.7.

Public Instance Methods

default(token) click to toggle source
# File lib/gammo/parser/insertion_mode/text.rb, line 25
def default(token)
  parser.insertion_mode = parser.original_insertion_mode
  parser.original_insertion_mode = nil
  halt token.instance_of?(Tokenizer::EndTagToken)
end
end_tag_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/text.rb, line 21
def end_tag_token(token)
  parser.open_elements.pop
end
error_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/text.rb, line 5
def error_token(token)
  parser.open_elements.pop
end
text_token(token) click to toggle source
# File lib/gammo/parser/insertion_mode/text.rb, line 9
def text_token(token)
  d = token.data
  n = parser.open_elements.last
  if n.tag == Tags::Textarea && n.first_child.nil?
    d = d.slice(1..-1) if d != "" && d.start_with?(?\r)
    d = d.slice(1..-1) if d != "" && d.start_with?(?\n)
  end
  halt true if d == ""
  parser.add_text(d)
  halt true
end