Split up handling of element names/namespaces.

This is now split up on Ragel level, simplifying the corresponding Ruby code.
This commit is contained in:
Yorick Peterse committed 2014-05-15 10:22:05 +02:00
1 parent 723a273e4f
commit 44bf1dd1ca
2 files changed
+39 -16

No files matched your search

+17 -9
View File
@@ -248,22 +248,30 @@ module Oga
##
# Called on the start of an element.
#
def on_element_start
add_token(:T_ELEM_START)
end
##
# Called on the name of an element.
#
# @param [String] name The name of the element, including namespace.
#
def on_element_start(name)
add_token(:T_ELEM_START)
if name.include?(':')
ns, name = name.split(':')
add_token(:T_ELEM_NS, ns)
end
def on_element_name(name)
@elements << name if html?
add_token(:T_ELEM_NAME, name)
end
##
# Called on the element namespace.
#
# @param [String] namespace
#
def on_element_ns(namespace)
add_token(:T_ELEM_NS, namespace)
end
##
# Called on the closing `>` of the open tag of an element.
#