[−][src]Struct seed::dom_types::El
A component in our virtual DOM.
MDN reference
web_sys
reference
Fields
tag: Tag
attrs: Attrs
style: Style
listeners: Vec<Listener<Ms>>
children: Vec<Node<Ms>>
node_ws: Option<Node>
The actual web element/node
namespace: Option<Namespace>
hooks: LifecycleHooks<Ms>
Implementations
impl<Ms> El<Ms>
[src]
pub fn empty(tag: Tag) -> Self
[src]
Create an empty element, specifying only the tag
pub fn empty_svg(tag: Tag) -> Self
[src]
Create an empty SVG element, specifying only the tag
pub fn from_markdown(markdown: &str) -> Vec<Node<Ms>>
[src]
Create elements from a markdown string.
pub fn from_html(html: &str) -> Vec<Node<Ms>>
[src]
Create elements from an HTML string.
pub fn add_child(&mut self, element: Node<Ms>) -> &mut Self
[src]
Add a new child to the element
pub fn add_attr(
&mut self,
key: impl Into<Cow<'static, str>>,
val: impl Into<AtValue>
) -> &mut Self
[src]
&mut self,
key: impl Into<Cow<'static, str>>,
val: impl Into<AtValue>
) -> &mut Self
Add an attribute (eg class, or href)
pub fn add_class(&mut self, name: impl Into<Cow<'static, str>>) -> &mut Self
[src]
Add a class. May be cleaner than add_attr
pub fn add_style(
&mut self,
key: impl Into<St>,
val: impl Into<CSSValue>
) -> &mut Self
[src]
&mut self,
key: impl Into<St>,
val: impl Into<CSSValue>
) -> &mut Self
Add a new style (eg display, or height)
pub fn add_listener(&mut self, listener: Listener<Ms>) -> &mut Self
[src]
Add a new listener
pub fn add_text(&mut self, text: impl Into<Cow<'static, str>>) -> &mut Self
[src]
Add a text node to the element. (ie between the HTML tags).
pub fn replace_text(&mut self, text: impl Into<Cow<'static, str>>) -> &mut Self
[src]
Replace the element's text. Removes all text nodes from element, then adds the new one.
pub fn get_text(&self) -> String
[src]
pub fn strip_ws_nodes_from_self_and_children(&mut self)
[src]
Remove websys nodes.
Trait Implementations
impl<Ms> Clone for El<Ms>
[src]
Allow the user to clone their Els. Note that there's no easy way to clone the closures within listeners or lifestyle hooks, so we omit them.
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Ms: Debug + 'static> Debug for El<Ms>
[src]
impl<Ms, '_> From<&'_ Element> for El<Ms>
[src]
fn from(ws_el: &Element) -> Self
[src]
Create a vdom node from a web_sys::Element
. Used in creating elements from html
and markdown strings. Includes children, recursively added.
impl<Ms: 'static, OtherMs: 'static> MessageMapper<Ms, OtherMs> for El<Ms>
[src]
type SelfWithOtherMs = El<OtherMs>
fn map_message(
self,
f: impl FnOnce(Ms) -> OtherMs + 'static + Clone
) -> El<OtherMs>
[src]
self,
f: impl FnOnce(Ms) -> OtherMs + 'static + Clone
) -> El<OtherMs>
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.
impl<Ms> PartialEq<El<Ms>> for El<Ms>
[src]
impl<Ms> UpdateEl<El<Ms>> for Attrs
[src]
impl<Ms, '_> UpdateEl<El<Ms>> for &'_ Attrs
[src]
impl<Ms> UpdateEl<El<Ms>> for El<Ms>
[src]
impl<Ms> UpdateEl<El<Ms>> for Vec<El<Ms>>
[src]
impl<Ms> UpdateEl<El<Ms>> for Node<Ms>
[src]
impl<Ms> UpdateEl<El<Ms>> for Vec<Node<Ms>>
[src]
impl<Ms> UpdateEl<El<Ms>> for Tag
[src]
This is intended only to be used for the custom! element macro.
impl<Ms, I, U, F> UpdateEl<El<Ms>> for Map<I, F> where
I: Iterator,
U: UpdateEl<El<Ms>>,
F: FnMut(I::Item) -> U,
[src]
I: Iterator,
U: UpdateEl<El<Ms>>,
F: FnMut(I::Item) -> U,
impl<Ms> UpdateEl<El<Ms>> for Style
[src]
impl<Ms, '_> UpdateEl<El<Ms>> for &'_ Style
[src]
impl<Ms> UpdateEl<El<Ms>> for Listener<Ms>
[src]
impl<Ms> UpdateEl<El<Ms>> for Vec<Listener<Ms>>
[src]
impl<Ms> UpdateEl<El<Ms>> for DidMount<Ms>
[src]
impl<Ms> UpdateEl<El<Ms>> for DidUpdate<Ms>
[src]
impl<Ms> UpdateEl<El<Ms>> for WillUnmount<Ms>
[src]
impl<Ms, '_> UpdateEl<El<Ms>> for &'_ str
[src]
impl<Ms> View<Ms> for El<Ms>
[src]
Auto Trait Implementations
impl<Ms> !RefUnwindSafe for El<Ms>
impl<Ms> !Send for El<Ms>
impl<Ms> !Sync for El<Ms>
impl<Ms> Unpin for El<Ms> where
Ms: Unpin,
Ms: Unpin,
impl<Ms> !UnwindSafe for El<Ms>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,