pub struct El<Ms> {
    pub tag: Tag,
    pub attrs: Attrs,
    pub style: Style,
    pub event_handler_manager: EventHandlerManager<Ms>,
    pub children: Vec<Node<Ms>>,
    pub namespace: Option<Namespace>,
    pub node_ws: Option<Node>,
    pub refs: Vec<SharedNodeWs>,
    pub key: Option<ElKey>,
    pub insert_handlers: Vec<InsertEventHandler<Ms>>,
}
Expand description

A component in our virtual DOM.

Note: Listeners in El’s event_handler_manager are not cloned, but recreated during VDOM patching.

MDN reference web_sys reference

Fields

tag: Tagattrs: Attrsstyle: Styleevent_handler_manager: EventHandlerManager<Ms>children: Vec<Node<Ms>>namespace: Option<Namespace>node_ws: Option<Node>

The actual DOM element/node.

refs: Vec<SharedNodeWs>key: Option<ElKey>insert_handlers: Vec<InsertEventHandler<Ms>>

Implementations

Create an empty element, specifying only the tag

Create an empty SVG element, specifying only the tag

Create elements from an HTML string.

Add a new child to the element

Add an attribute (eg class, or href)

Add a class. May be cleaner than add_attr

Add a new style (eg display, or height),

Add a new event handler.

Add a text node to the element. (ie between the HTML tags).

Replace the element’s text. Removes all text nodes from element, then adds the new one.

Warn user about potential bugs when having scripts and Takeover mount type.

Remove websys nodes.

Is it a custom element?

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Create a vdom node from a web_sys::Element. Used in creating elements from html and markdown strings. Includes children, recursively added.

Maps an element’s message to have another message.

This allows third party components to integrate with your application without having to know about your Msg type beforehand.

Note

There is an overhead to calling this versus keeping all messages under one type. The deeper the nested structure of children, the more time this will take to run.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.