diff --git a/src/events/event_target.c b/src/events/event_target.c index f05affd..f35abc5 100644 --- a/src/events/event_target.c +++ b/src/events/event_target.c @@ -223,7 +223,11 @@ dom_exception _dom_event_target_dispatch(dom_event_target *et, evt->current = et; + bool ok = true; + do { + ok = le != eti->listeners; + if (dom_string_isequal(le->type, evt->type)) { assert(le->listener->handler != NULL); @@ -244,8 +248,7 @@ dom_exception _dom_event_target_dispatch(dom_event_target *et, } } - le = (struct listener_entry *) le->list.next; - } while (le != eti->listeners); + } while (ok); } if (evt->prevent_default == true)