fix subscriptions in events
This commit is contained in:
1 parent
07ed3e67dd
commit
a6f611eccf
12 files changed
+445
-103
No files matched your search
@@ -391,9 +391,12 @@ impl VirtualDom {
|
||||
// We check the bubble state between each call to see if the event has been stopped from bubbling
|
||||
for listener in listeners.drain(..).rev() {
|
||||
if let AttributeValue::Listener(listener) = listener {
|
||||
if let Some(cb) = listener.borrow_mut().as_deref_mut() {
|
||||
let origin = listener.origin;
|
||||
self.runtime.scope_stack.borrow_mut().push(origin);
|
||||
if let Some(cb) = listener.callback.borrow_mut().as_deref_mut() {
|
||||
cb(uievent.clone());
|
||||
}
|
||||
self.runtime.scope_stack.borrow_mut().pop();
|
||||
|
||||
if !uievent.propagates.get() {
|
||||
return;
|
||||
@@ -422,9 +425,12 @@ impl VirtualDom {
|
||||
// Only call the listener if this is the exact target element.
|
||||
if attr.name.trim_start_matches("on") == name && target_path == this_path {
|
||||
if let AttributeValue::Listener(listener) = &attr.value {
|
||||
if let Some(cb) = listener.borrow_mut().as_deref_mut() {
|
||||
let origin = listener.origin;
|
||||
self.runtime.scope_stack.borrow_mut().push(origin);
|
||||
if let Some(cb) = listener.callback.borrow_mut().as_deref_mut() {
|
||||
cb(uievent.clone());
|
||||
}
|
||||
self.runtime.scope_stack.borrow_mut().pop();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user