Merge pull request #878 from Demonthos/fix-event-bubbling-within-template
Fix event bubbling within a single template
This commit is contained in:
2 files changed
+4
-4
No files matched your search
@@ -175,10 +175,10 @@ impl VirtualDom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ElementPath {
|
impl ElementPath {
|
||||||
pub(crate) fn is_ascendant(&self, big: &&[u8]) -> bool {
|
pub(crate) fn is_decendant(&self, small: &&[u8]) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
ElementPath::Deep(small) => small.len() <= big.len() && small == &big[..small.len()],
|
ElementPath::Deep(big) => small.len() <= big.len() && *small == &big[..small.len()],
|
||||||
ElementPath::Root(r) => big.len() == 1 && big[0] == r as u8,
|
ElementPath::Root(r) => small.len() == 1 && small[0] == r as u8,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ impl VirtualDom {
|
|||||||
|
|
||||||
// Remove the "on" prefix if it exists, TODO, we should remove this and settle on one
|
// Remove the "on" prefix if it exists, TODO, we should remove this and settle on one
|
||||||
if attr.name.trim_start_matches("on") == name
|
if attr.name.trim_start_matches("on") == name
|
||||||
&& target_path.is_ascendant(&this_path)
|
&& target_path.is_decendant(&this_path)
|
||||||
{
|
{
|
||||||
listeners.push(&attr.value);
|
listeners.push(&attr.value);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user