fix: event delegation issue with `<input name="host">` (#1332)
This commit is contained in:
parent
a0fae88f7d
commit
d4b1ceda90
|
@ -49,6 +49,7 @@ features = [
|
|||
"Range",
|
||||
"Text",
|
||||
"HtmlCollection",
|
||||
"ShadowRoot",
|
||||
"TreeWalker",
|
||||
|
||||
# Events we cast to in leptos_macro -- added here so we don't force users to import them
|
||||
|
|
|
@ -158,19 +158,13 @@ pub(crate) fn add_delegated_event_listener(
|
|||
}
|
||||
|
||||
// navigate up tree
|
||||
let host =
|
||||
js_sys::Reflect::get(&node, &JsValue::from_str("host"))
|
||||
.unwrap_throw();
|
||||
if host.is_truthy()
|
||||
&& host != node
|
||||
&& host.dyn_ref::<web_sys::Node>().is_some()
|
||||
{
|
||||
node = host;
|
||||
} else if let Some(parent) =
|
||||
node.unchecked_into::<web_sys::Node>().parent_node()
|
||||
if let Some(parent) =
|
||||
node.unchecked_ref::<web_sys::Node>().parent_node()
|
||||
{
|
||||
node = parent.into()
|
||||
} else {
|
||||
} else if let Some(root) = node.dyn_ref::<web_sys::ShadowRoot>() {
|
||||
node = root.host().unchecked_into();
|
||||
} else {
|
||||
node = JsValue::null()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue