feat: add prevent default attribute and upgrade router

This commit is contained in:
Jonathan Kelley committed 2022-01-05 16:34:24 -05:00
1 parent cb2782b4bb
commit 427b126bc1
16 files changed
+220 -181

No files matched your search

+7 -7
View File
@@ -143,7 +143,7 @@ impl ScopeArena {
// Removes a scope and its descendents from the arena
pub fn try_remove(&self, id: ScopeId) -> Option<()> {
log::debug!("removing scope {:?}", id);
log::trace!("removing scope {:?}", id);
self.ensure_drop_safety(id);
// Safety:
@@ -189,7 +189,7 @@ impl ScopeArena {
/// This also makes sure that drop order is consistent and predictable. All resources that rely on being dropped will
/// be dropped.
pub(crate) fn ensure_drop_safety(&self, scope_id: ScopeId) {
log::debug!("Ensuring drop safety for scope {:?}", scope_id);
log::trace!("Ensuring drop safety for scope {:?}", scope_id);
if let Some(scope) = self.get_scope(scope_id) {
let mut items = scope.items.borrow_mut();
@@ -220,7 +220,7 @@ impl ScopeArena {
// Cycle to the next frame and then reset it
// This breaks any latent references, invalidating every pointer referencing into it.
// Remove all the outdated listeners
log::debug!("Running scope {:?}", id);
log::trace!("Running scope {:?}", id);
self.ensure_drop_safety(id);
// todo: we *know* that this is aliased by the contents of the scope itself
@@ -282,18 +282,18 @@ impl ScopeArena {
let nodes = self.nodes.borrow();
let mut cur_el = Some(element);
log::debug!("calling listener {:?}, {:?}", event, element);
log::trace!("calling listener {:?}, {:?}", event, element);
let state = Rc::new(BubbleState::new());
while let Some(id) = cur_el.take() {
if let Some(el) = nodes.get(id.0) {
log::debug!("Found valid receiver element");
log::trace!("Found valid receiver element");
let real_el = unsafe { &**el };
if let VNode::Element(real_el) = real_el {
for listener in real_el.listeners.borrow().iter() {
if listener.event == event.name {
log::debug!("Found valid receiver event");
log::trace!("Found valid receiver event");
if state.canceled.get() {
// stop bubbling if canceled
@@ -912,7 +912,7 @@ impl TaskQueue {
} else {
// todo: it should be okay to remote a fut while the queue is being polled
// However, it's not currently possible to do that.
log::debug!("Unable to remove task from task queue. This is probably a bug.");
log::trace!("Unable to remove task from task queue. This is probably a bug.");
}
}
pub(crate) fn has_tasks(&self) -> bool {