lib/html: implement the tag list as an hashset instead of a array.
authorJean Privat <jean@pryen.org>
Mon, 19 Oct 2015 19:48:22 +0000 (15:48 -0400)
committerJean Privat <jean@pryen.org>
Mon, 19 Oct 2015 19:48:22 +0000 (15:48 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/html/html.nit

index d3a92eb..72284ef 100644 (file)
@@ -107,7 +107,12 @@ class HTMLTag
        # `"div"` for `<div></div>`.
        var tag: String
        init do
-               self.is_void = (once ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]).has(tag)
+               self.is_void = (once void_list).has(tag)
+       end
+
+       private fun void_list: Set[String]
+       do
+               return new HashSet[String].from(["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"])
        end
 
        # Is the HTML element a void element?