macro_rules! with_node { ($this:ident, $name:ident => { $($methods:tt)* }) => { ... }; }
Expand description
Gives access to the internal DOM node.
Sometimes you need to access the real DOM node, for example to call
DOM methods. You can use with_node!
to do that:
html!("input" => web_sys::HtmlInputElement, {
.with_node!(element => {
.event(move |_: events::Input| {
// `element` is the internal <input> DOM node,
// so we can call HtmlInputElement methods
let value = element.value_as_number();
})
})
})