Release 3.9 Support for Custom Elements
New custom element feature that allows to define HtmlFlow views such as the listing at the end of this post (this feature applies regardless being a static or a dynamic view).
This sample is available on unit tests htmlflow.test.views.HtmlCustomElements
Invoking .custom("alert-info")
returns an instance of a new
class CustomElement
that inherits from existing Div
class.
Hence, we have most HTML features available at the resulting instance.
Solves https://github.com/xmlet/HtmlFlow/pull/80
StaticHtml
.view()
.html()
.head()
.script()
.attrSrc("alert.js") // Link to alert-info definition
.attrDefer(true)
.__()
.__()
.body()
.div()
.attrClass("container")
.p().text("Testing custom elements!").__()
.custom("alert-info") // alert-info should be stored in the new Element and accessible to the Visitor.
.addAttr("title", "Information")
.addAttr("message", "This is a message for a custom element")
.addAttr("kind", "success")
.ul()
.li().text("For any reason we could even include other elements.").__()
.__() // ul
.__() // alert-info
.__() // div
.__() // body
.__(); //html