# `"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?
# var p = new HTMLTag("p")
# p.text("Hello World!")
# assert p.write_to_string == "<p>Hello World!</p>"
- # Text is escaped see: `standard::String::html_escape`
+ # Text is escaped see: `core::String::html_escape`
fun text(txt: String): HTMLTag do
children.clear
# p.add(new HTMLTag("br"))
# p.append("World!")
# assert p.write_to_string == "<p>Hello<br/>World!</p>"
- # 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