X-Git-Url: http://nitlanguage.org diff --git a/lib/html/html.nit b/lib/html/html.nit index 6a24c07..72284ef 100644 --- a/lib/html/html.nit +++ b/lib/html/html.nit @@ -107,7 +107,12 @@ class HTMLTag # `"div"` for `
`. 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? @@ -246,7 +251,7 @@ class HTMLTag # var p = new HTMLTag("p") # p.text("Hello World!") # assert p.write_to_string == "

Hello World!

" - # Text is escaped see: `standard::String::html_escape` + # Text is escaped see: `core::String::html_escape` fun text(txt: String): HTMLTag do children.clear @@ -261,7 +266,7 @@ class HTMLTag # p.add(new HTMLTag("br")) # p.append("World!") # assert p.write_to_string == "

Hello
World!

" - # Text is escaped see: standard::String::html_escape + # Text is escaped see: core::String::html_escape fun append(txt: String): HTMLTag do add(new HTMLRaw("", txt.html_escape)) return self