module salix::Node
rascal-0.34.0
salix-core-0.2.3
Usage
import salix::Node;
Source code
http://github.com/usethesource/salix-core/src/main/rascal/salix/Node.rsc
Dependencies
import List;
data Node
data Node
= hnode(NodeType \type, str tagName="", list[Node] kids=[], map[str,str] attrs=(),
map[str,str] props=(), map[str,Hnd] events=(), map[str,value] extra=(),
str id="", str kind="", str contents="")
;
The basic Html node type, defining constructors for elements, text nodes, and native nodes (which are managed in js).
data NodeType
data NodeType
= element()
| txt()
| empty()
;
data Attr
data Attr
= attr(str name, str val)
| prop(str name, str val)
| event(str name, Hnd handler, map[str,str] options = ())
| null()
;
Generalized attributes to be produced by explicit attribute construction functions (such as class(str), onClick(Msg), or \value(str)). null() acts as a zero element and is always ignored.
function attrsOf
map[str,str] attrsOf(list[Attr] attrs)
Helper functions to partition list of Attrs into attrs, props and events
function propsOf
map[str,str] propsOf(list[Attr] attrs)
function eventsOf
map[str,Hnd] eventsOf(list[Attr] attrs)
function bareHtml
Node bareHtml(Node n)
function toHtml
str toHtml(h:hnode(element()))
str toHtml(h:hnode(txt()))
function kids2html
str kids2html(list[Node] kids)
function attrs2str
str attrs2str(map[str, str] attrs)