Add single-element setup_el function
@@ -369,15 +369,10 @@ impl<Ms: Clone, Mdl> App<Ms, Mdl> {
}
}
-/// Populate the attached web_sys elements. Run this after creating a vdom, but before using it to
-/// process the web_sys dom. Does not attach children in the DOM. Run this on the top-level
-/// element.
-pub(crate) fn setup_els<Ms>(document: &Document, el_vdom: &mut El<Ms>)
-// pub for tests.
+fn setup_el<Ms>(document: &Document, el: &mut El<Ms>)
where
Ms: Clone + 'static,
{
- el_vdom.walk_tree_mut(|el| {
// Set up controlled components: Input, Select, and TextArea elements must stay in sync with the model;
// don't let them get out of sync from typing or other events, which can occur if a change
// doesn't trigger a re-render, or if something else modifies them using a side effect.
@@ -404,7 +399,17 @@ where
let el_ws = websys_bridge::make_websys_el(el, document);
el.el_ws = Some(el_ws);
- });
+}
+
+/// Populate the attached web_sys elements. Run this after creating a vdom, but before using it to
+/// process the web_sys dom. Does not attach children in the DOM. Run this on the top-level
+/// element.
+pub(crate) fn setup_els<Ms>(document: &Document, el_vdom: &mut El<Ms>)
+// pub for tests.
+where
+ Ms: Clone + 'static,
+{
+ el_vdom.walk_tree_mut(|el| setup_el(document, el));
}
impl<Ms: Clone, Mdl> Clone for App<Ms, Mdl> {
