pub struct Dom<Message = (), Command = (), Key = ()> {
pub attributes: Vec<Attr>,
pub events: Vec<Event<Message>>,
pub children: Vec<Dom<Message, Command, Key>>,
/* private fields */
}Expand description
A node in the DOM.
Fields§
§attributes: Vec<Attr>Attributes on this node.
events: Vec<Event<Message>>Event handlers associated with this node.
children: Vec<Dom<Message, Command, Key>>Children of this node.
Implementations§
Source§impl<Message, Command, Key> Dom<Message, Command, Key>
impl<Message, Command, Key> Dom<Message, Command, Key>
Sourcepub fn component(
msg: Message,
create: fn(Dispatcher<Message, Command>) -> Box<dyn Component<Message>>,
) -> Self
pub fn component( msg: Message, create: fn(Dispatcher<Message, Command>) -> Box<dyn Component<Message>>, ) -> Self
Create a component.
Sourcepub unsafe fn inner_html(self, value: impl Into<String>) -> Self
pub unsafe fn inner_html(self, value: impl Into<String>) -> Self
Set innerHtml on this node. Use with caution as this can be used as an attack vector to execute arbitrary code in the client’s browser.
Sourcepub fn attr(self, name: &'static str, value: impl Into<String>) -> Self
pub fn attr(self, name: &'static str, value: impl Into<String>) -> Self
Add an attribute to this DOM element.
Sourcepub fn event(self, trigger: &'static str, msg: Message) -> Self
pub fn event(self, trigger: &'static str, msg: Message) -> Self
Add an event listener to this DOM element.
Sourcepub fn on(self, trigger: &'static str, handler: Handler<Message>) -> Self
pub fn on(self, trigger: &'static str, handler: Handler<Message>) -> Self
Add an event listener to this DOM element.
Sourcepub fn onchange(self, handler: fn(String) -> Option<Message>) -> Self
pub fn onchange(self, handler: fn(String) -> Option<Message>) -> Self
Add a change event listener to this DOM element.
Sourcepub fn oninput(self, handler: fn(InputEvent) -> Option<Message>) -> Self
pub fn oninput(self, handler: fn(InputEvent) -> Option<Message>) -> Self
Add an input event listener to this DOM element.
Sourcepub fn push(self, child: impl Into<Dom<Message, Command, Key>>) -> Self
pub fn push(self, child: impl Into<Dom<Message, Command, Key>>) -> Self
Append the given element as a child on this DOM element.
Sourcepub fn extend(
self,
iter: impl IntoIterator<Item = Dom<Message, Command, Key>>,
) -> Self
pub fn extend( self, iter: impl IntoIterator<Item = Dom<Message, Command, Key>>, ) -> Self
Append the elements returned by the given iterator as children on this DOM element.
Trait Implementations§
Auto Trait Implementations§
impl<Message, Command, Key> Freeze for Dom<Message, Command, Key>
impl<Message, Command, Key> RefUnwindSafe for Dom<Message, Command, Key>where
Message: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Message, Command, Key> Send for Dom<Message, Command, Key>
impl<Message, Command, Key> Sync for Dom<Message, Command, Key>
impl<Message, Command, Key> Unpin for Dom<Message, Command, Key>
impl<Message, Command, Key> UnwindSafe for Dom<Message, Command, Key>where
Message: UnwindSafe,
Key: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<M> Update<()> for M
impl<M> Update<()> for M
Source§fn update(&mut self, msg: Message, _commands: &mut Commands<Command>)
fn update(&mut self, msg: Message, _commands: &mut Commands<Command>)
Update the model using the given message. Implement this to describe the behavior of your
app.
Source§fn simple_update(&mut self, _msg: Message)
fn simple_update(&mut self, _msg: Message)
Update the model using the given message. Implement this if your app does not need to use
side effecting commands.