summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/events/event_target.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index ee98c03..984a020 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
# Component settings
COMPONENT := dom
-COMPONENT_VERSION := 0.3.1
+COMPONENT_VERSION := 0.3.2
# Default to a static library
COMPONENT_TYPE ?= lib-static
diff --git a/src/events/event_target.c b/src/events/event_target.c
index ef2dc83..4592fee 100644
--- a/src/events/event_target.c
+++ b/src/events/event_target.c
@@ -99,6 +99,9 @@ dom_exception _dom_event_target_add_event_listener(
/**
* Remove an EventListener from the EventTarget
*
+ * (LibDOM extension: If type is NULL, remove all listener registrations
+ * regardless of type and cature)
+ *
* \param et The EventTarget object
* \param type The event type this listener is registered for
* \param listener The listener object
@@ -114,9 +117,15 @@ dom_exception _dom_event_target_remove_event_listener(
struct listener_entry *le = eti->listeners;
do {
- if (dom_string_isequal(le->type, type) &&
- le->listener == listener &&
- le->capture == capture) {
+ bool matches;
+ if (type == NULL) {
+ matches = (le->listener == listener);
+ } else {
+ matches = dom_string_isequal(le->type, type) &&
+ (le->listener == listener) &&
+ (le->capture == capture);
+ }
+ if (matches) {
if (le->list.next == &le->list) {
eti->listeners = NULL;
} else {