abstract class
Components::Elements::ContainerElement
Overview
Base class for container HTML elements that can have children
Direct Known Subclasses
- Components::Elements::A
- Components::Elements::Abbr
- Components::Elements::Article
- Components::Elements::Aside
- Components::Elements::Audio
- Components::Elements::B
- Components::Elements::Blockquote
- Components::Elements::Body
- Components::Elements::Button
- Components::Elements::Canvas
- Components::Elements::Caption
- Components::Elements::Cite
- Components::Elements::Code
- Components::Elements::Colgroup
- Components::Elements::Data
- Components::Elements::Datalist
- Components::Elements::Dd
- Components::Elements::Del
- Components::Elements::Details
- Components::Elements::Dialog
- Components::Elements::Div
- Components::Elements::Dl
- Components::Elements::Dt
- Components::Elements::Em
- Components::Elements::Fieldset
- Components::Elements::Figcaption
- Components::Elements::Figure
- Components::Elements::Footer
- Components::Elements::Form
- Components::Elements::Head
- Components::Elements::Header
- Components::Elements::Heading
- Components::Elements::Html
- Components::Elements::I
- Components::Elements::Iframe
- Components::Elements::Ins
- Components::Elements::Kbd
- Components::Elements::Label
- Components::Elements::Legend
- Components::Elements::Li
- Components::Elements::Main
- Components::Elements::Mark
- Components::Elements::Menu
- Components::Elements::Meter
- Components::Elements::Nav
- Components::Elements::Object
- Components::Elements::Ol
- Components::Elements::Optgroup
- Components::Elements::Option
- Components::Elements::Output
- Components::Elements::P
- Components::Elements::Picture
- Components::Elements::Pre
- Components::Elements::Progress
- Components::Elements::S
- Components::Elements::Samp
- Components::Elements::Script
- Components::Elements::Section
- Components::Elements::Select
- Components::Elements::Small
- Components::Elements::Span
- Components::Elements::Strong
- Components::Elements::Style
- Components::Elements::Sub
- Components::Elements::Summary
- Components::Elements::Sup
- Components::Elements::Svg
- Components::Elements::Table
- Components::Elements::Tbody
- Components::Elements::Td
- Components::Elements::Textarea
- Components::Elements::Tfoot
- Components::Elements::Th
- Components::Elements::Thead
- Components::Elements::Time
- Components::Elements::Title
- Components::Elements::Tr
- Components::Elements::U
- Components::Elements::Ul
- Components::Elements::Var
- Components::Elements::Video
Defined in:
components/elements/base/container_element.crConstructors
Instance Method Summary
-
#<<(child : ContainerElement) : ContainerElement
Add a container element child and return the child for chaining This enables patterns like: parent << Child.new << "text" where "text" becomes a child of Child, not parent
-
#<<(child : VoidElement | String | RawHTML) : self
Add text content, void elements, or raw HTML and return self for chaining This enables patterns like: element << "One" << "Two" << "Three"
-
#add_child(child : HTMLElement | String | RawHTML) : self
Add a child element or text content
-
#add_children(*children : HTMLElement | String | RawHTML) : self
Add multiple children at once
-
#add_raw_html(html : String) : self
Add raw HTML content (not escaped)
-
#build(&block : self -> Nil) : self
Build content using a block
-
#children_count : Int32
Get the number of children
-
#clear : self
Clear all children
-
#empty? : Bool
Check if element has children
-
#render : String
Render the complete element with opening tag, children, and closing tag
Instance methods inherited from class Components::Elements::HTMLElement
[](name : String) : String | Nil
[],
add_class(class_names : String) : self
add_class,
add_style(styles : String) : self
add_style,
attributes : Hash(String, String)
attributes,
can_have_children? : Bool
can_have_children?,
children : Array(HTMLElement | String | RawHTML)
children,
has_class?(class_name : String) : Bool
has_class?,
remove_attribute(name : String) : self
remove_attribute,
remove_class(class_names : String) : self
remove_class,
render : String
render,
set_attribute(name : String, value : String | Nil) : self
set_attribute,
set_safe_style(style : SafeStyleValue) : self
set_safe_style,
set_safe_url_attribute(name : String, url : SafeURL) : self
set_safe_url_attribute,
tag_name : String
tag_name,
to_s(io : IO) : Nil
to_s,
void_element? : Bool
void_element?
Constructor methods inherited from class Components::Elements::HTMLElement
new(tag_name : String, **attrs)
new
Constructor Detail
Instance Method Detail
Add a container element child and return the child for chaining This enables patterns like: parent << Child.new << "text" where "text" becomes a child of Child, not parent
Add text content, void elements, or raw HTML and return self for chaining This enables patterns like: element << "One" << "Two" << "Three"
Add a child element or text content
Add multiple children at once