Skip to content

Commit

Permalink
add impls into web_sys::HtmlElement for ElementMaybeSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
blorbb committed May 28, 2024
1 parent 2523f17 commit 384ca08
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/element_maybe_signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::marker::PhantomData;
use std::ops::Deref;

/// Used as an argument type to make it easily possible to pass either
/// * a `web_sys` element that implements `E` (for example `EventTarget` or `Element`),
/// * a `web_sys` element that implements `E` (for example `EventTarget`, `Element` or `HtmlElement`),
/// * an `Option<T>` where `T` is the web_sys element,
/// * a `Signal<T>` where `T` is the web_sys element,
/// * a `Signal<Option<T>>` where `T` is the web_sys element,
Expand Down Expand Up @@ -287,6 +287,7 @@ macro_rules! impl_from_node_ref {

impl_from_node_ref!(web_sys::EventTarget);
impl_from_node_ref!(web_sys::Element);
impl_from_node_ref!(web_sys::HtmlElement);

// From leptos::html::HTMLElement ///////////////////////////////////////////////

Expand All @@ -306,6 +307,7 @@ macro_rules! impl_from_html_element {

impl_from_html_element!(web_sys::EventTarget);
impl_from_html_element!(web_sys::Element);
impl_from_html_element!(web_sys::HtmlElement);

// From Signal<leptos::html::HTMLElement> /////////////////////////////////////////

Expand Down Expand Up @@ -366,3 +368,11 @@ impl_from_signal_html_element!(Signal<Option<HtmlElement<HtmlEl>>>, web_sys::Ele
impl_from_signal_html_element!(ReadSignal<Option<HtmlElement<HtmlEl>>>, web_sys::Element);
impl_from_signal_html_element!(RwSignal<Option<HtmlElement<HtmlEl>>>, web_sys::Element);
impl_from_signal_html_element!(Memo<Option<HtmlElement<HtmlEl>>>, web_sys::Element);

impl_from_signal_html_element!(Signal<Option<HtmlElement<HtmlEl>>>, web_sys::HtmlElement);
impl_from_signal_html_element!(
ReadSignal<Option<HtmlElement<HtmlEl>>>,
web_sys::HtmlElement
);
impl_from_signal_html_element!(RwSignal<Option<HtmlElement<HtmlEl>>>, web_sys::HtmlElement);
impl_from_signal_html_element!(Memo<Option<HtmlElement<HtmlEl>>>, web_sys::HtmlElement);

0 comments on commit 384ca08

Please sign in to comment.