Html

io.eezo.core.html.Html
See theHtml companion object
enum Html

eezo's HTML node tree.

Four cases and no more. There is no Comment case, because nothing eezo renders emits one and Html.raw covers it if something ever does, and no Doctype case, because Html.doctype is a Raw the caller puts first. A case that may legally appear at exactly one position in the tree is a case every match in modules/live has to handle and then ignore.

Attributes

Companion
object
Source
Html.scala
Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Enum entries

final case class Element(name: String, attrs: Vector[Attr], key: Option[String], children: Vector[Html])

An element. Void ness is a property of the tag name, looked up in an internal void tag table at render time, so Element("br", …, void = false) is not a state that exists.

An element. Void ness is a property of the tag name, looked up in an internal void tag table at render time, so Element("br", …, void = false) is not a state that exists.

key is a field rather than an ordinary attribute because modules/live addresses list children by identity, and a requirement one module places on another belongs in a type rather than in a string two modules agree on by convention. It renders as data-eezo-key.

Attributes

Source
Html.scala
final case class Fragment(children: Vector[Html])

Several nodes with no element of their own.

Several nodes with no element of their own.

A Fragment renders its children and nothing of its own, so one tree child can become several DOM nodes, and every index after it would run ahead of the tree if the fragment were left in place. For example, div(span("a"), text("x") ++ text("y"), span("z")) renders `

axyz, which a browser parses as three DOM children; left unspliced, the two text nodes would sit behind one tree child. [[Tag.apply]] is the guard: it splices aFragmentchild into its parent's children, then merges adjacentTextchildren and drops empty ones, because the parser knows no boundary betweenxandyeither, so anElementbuilt through a tag holds exactly three children here and tree child index equals DOM child index. That guard isTag.apply's alone; building anElementby hand with aFragmentamong its children, or nesting oneFragment` inside another before it reaches a tag, sits outside it. The case survives as a root level value, where there is no parent to index into.

Attributes

Source
Html.scala
final case class Raw(html: String)

The single unescaped path into the tree.

The single unescaped path into the tree.

Mounting stops at its layer. Route.under moves a Url.Mounted wherever one sits in an attribute, and raw content is a string eezo never parses, so a link written inside it keeps whatever it says and stays where the author put it.

Attributes

Source
Html.scala
final case class Text

Text that is already escaped. The constructor is package private, so Html.text is the only way to build one from outside io.eezo.core.html, while the pattern match that the differ in modules/live needs still compiles from anywhere.

Text that is already escaped. The constructor is package private, so Html.text is the only way to build one from outside io.eezo.core.html, while the pattern match that the differ in modules/live needs still compiles from anywhere.

Attributes

Source
Html.scala