So, the problems is easy to work around, but still little unclear.
I have 2D text element. It has mouseleave and mouseup event listeners.
In mouseup I destroy this element, but mouseleave still fires on destroyed element.
Before destroy this element I can call element.off(); and it works pretty well - mouseleave doesn’t fire.
But I don’t understand why it is necessary? Probably it would be better to implement this behavior by destroy method?
Repro PlayCanvas 3D HTML5 Game Engine
this.entity.element.on("mouseup", function(event) {
//event.element.off(); Toggle this line to reproduse
event.element.entity.destroy();
});