From 4847789a839d1486fcba18ca849cbac8565c310f Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Sun, 12 Mar 2023 14:47:30 -0500 Subject: [PATCH] fix event bubbling within a single template --- packages/core/src/arena.rs | 6 +++--- packages/core/src/virtual_dom.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/arena.rs b/packages/core/src/arena.rs index 7fbaf0e12..caa863adf 100644 --- a/packages/core/src/arena.rs +++ b/packages/core/src/arena.rs @@ -175,10 +175,10 @@ impl VirtualDom { } impl ElementPath { - pub(crate) fn is_ascendant(&self, big: &&[u8]) -> bool { + pub(crate) fn is_decendant(&self, small: &&[u8]) -> bool { match *self { - ElementPath::Deep(small) => small.len() <= big.len() && small == &big[..small.len()], - ElementPath::Root(r) => big.len() == 1 && big[0] == r as u8, + ElementPath::Deep(big) => small.len() <= big.len() && *small == &big[..small.len()], + ElementPath::Root(r) => small.len() == 1 && small[0] == r as u8, } } } diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index a29671f5d..2269815aa 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -396,7 +396,7 @@ impl VirtualDom { // Remove the "on" prefix if it exists, TODO, we should remove this and settle on one if attr.name.trim_start_matches("on") == name - && target_path.is_ascendant(&this_path) + && target_path.is_decendant(&this_path) { listeners.push(&attr.value);