Friday, October 12, 2018

Passing method references to HTMLElement.removeEventHandler

I think I found a little bug in the java 8 support in GWT. Or at least, it does not work as I expected it would.
I am using Elemental2 and I am trying to remove an EventListener from a HTMLElement.

The listener was previously installed like this:

element.addEventListener("click", this::handleClick)

when I remove the listener, I also use the same method reference on the same object.
element.removeEventListener("click", this::handleClick)

but in reality the click handler is not removed.

I was expecting that this method reference would always yield the same JS object, but it does not seem that way.
Is that intentional or a bug or am I missing something ?

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment