Generic

zio.blocks.html.Dom.Element.Generic
final case class Generic(tag: String, attributes: Chunk[Attribute], children: Chunk[Dom]) extends Element

A generic HTML element.

Represents any standard HTML tag (e.g., "div", "p", "span"). Text content in children is HTML-escaped during rendering.

Equality is structural across all Element implementations: a Generic equals any other element with the same tag, attributes, children, and text-escaping semantics, regardless of the concrete class (e.g., Generic("li", ...) equals the equivalent LiElement).

Value parameters

attributes

attribute key-value pairs

children

child DOM nodes

tag

the element tag name (e.g., "div", "h1")

Attributes

Source
Dom.scala
Graph
Supertypes
trait Element
trait Dom
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def equals(other: Any): Boolean

Checks whether this instance is equal to that. This universal equality method is defined in AnyRef.

Checks whether this instance is equal to that. This universal equality method is defined in AnyRef.

Attributes

Definition Classes
Equals -> Any
Source
Dom.scala
override def hashCode: Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
Source
Dom.scala

Attributes

Source
Dom.scala
def withChildren(kids: Chunk[Dom]): Generic

Attributes

Source
Dom.scala

Inherited methods

def &(other: CssSelectable): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def +(adjacent: CssSelectable): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def >(child: CssSelectable): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def >>(descendant: CssSelectable): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def apply(effect: DomModifier, effects: DomModifier*): Element

Attributes

Inherited from:
Element
Source
Dom.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def collect(pf: PartialFunction[Dom, Dom]): List[Dom]

Collects all nodes in the tree matching the given partial function.

Collects all nodes in the tree matching the given partial function.

Traverses the entire tree in depth-first order, applying the partial function to each node and collecting matches.

Value parameters

pf

the partial function to apply; nodes that match contribute their transformed values

Attributes

Returns

a list of matching nodes (or their transformed versions)

Inherited from:
Dom
Source
Dom.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def filter(predicate: Dom => Boolean): Dom

Filters the tree to keep only nodes satisfying the predicate.

Filters the tree to keep only nodes satisfying the predicate.

Removes any node for which the predicate returns false, and recursively filters children. Empty branches collapse to Empty.

Value parameters

predicate

the condition each node must satisfy

Attributes

Returns

a new tree with non-matching nodes removed

Inherited from:
Dom
Source
Dom.scala
def find(predicate: Dom => Boolean): Option[Dom]

Finds the first node in the tree satisfying the predicate.

Finds the first node in the tree satisfying the predicate.

Traverses the tree in depth-first order and returns the first matching node.

Value parameters

predicate

the condition to search for

Attributes

Returns

Some(node) if a match is found, None otherwise

Inherited from:
Dom
Source
Dom.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def isEmpty: Boolean

Checks whether this node renders to empty HTML.

Checks whether this node renders to empty HTML.

Returns true if the node is Empty or a Text with empty content.

Attributes

Returns

true if this node produces no output when rendered

Inherited from:
Dom
Source
Dom.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def nthChild(formula: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def nthChild(n: Int): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def part(name: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
def render(indent: Int): String

Renders the DOM tree to a pretty-printed HTML string with indentation.

Renders the DOM tree to a pretty-printed HTML string with indentation.

Text content is HTML-escaped. Script and Style elements render their children without escaping to allow inline code.

Value parameters

indent

the number of spaces per indentation level; if <= 0, behaves like render

Attributes

Returns

formatted HTML with newlines and indentation

Inherited from:
Dom
Source
Dom.scala
def render: String

Renders the DOM tree to a minified HTML string.

Renders the DOM tree to a minified HTML string.

Text content is HTML-escaped. Script and Style elements render their children without escaping to allow inline code.

Attributes

Returns

minified HTML output with no extra whitespace

Inherited from:
Dom
Source
Dom.scala
def renderMinified: String

Renders the DOM tree to a minified HTML string (alias for render).

Renders the DOM tree to a minified HTML string (alias for render).

Attributes

Returns

minified HTML output

Inherited from:
Dom
Source
Dom.scala
def select(selector: CssSelector): DomSelection

Selects all descendant nodes matching the given CSS selector.

Selects all descendant nodes matching the given CSS selector.

Value parameters

selector

the CSS selector to match against

Attributes

Returns

a DomSelection containing all matching descendant nodes

Inherited from:
Dom
Source
Dom.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def transform(f: Dom => Dom): Dom

Transforms every node in the tree using the given function.

Transforms every node in the tree using the given function.

Applies the transformation function to each node in depth-first order, then recursively transforms children of Elements. Suitable for rewriting the tree, e.g., removing nodes, modifying attributes, or simplifying structure.

Value parameters

f

the transformation function to apply to each node

Attributes

Returns

a new tree with all nodes transformed

Inherited from:
Dom
Source
Dom.scala

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def when(condition: Boolean)(effect: DomModifier, effects: DomModifier*): Element

Attributes

Inherited from:
Element
Source
Dom.scala
def whenSome[T](option: Option[T])(f: T => Seq[DomModifier]): Element

Attributes

Inherited from:
Element
Source
Dom.scala
def withAttribute(attr: String, value: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def withAttribute(attr: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def withAttributeContaining(attr: String, value: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def withAttributeEnding(attr: String, value: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def withAttributePrefix(attr: String, value: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def withAttributeStarting(attr: String, value: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def withAttributeWord(attr: String, value: String): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def |(other: CssSelectable): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala
def ~(sibling: CssSelectable): CssSelector

Attributes

Inherited from:
CssSelectable
Source
CssSelectable.scala

Inherited fields

Attributes

Inherited from:
Element
Source
Dom.scala