Closed LazyCompiler closed 2 years ago
An undefined event listener just gets ignored so I'm not sure what the bug is?
Because this data is required and not optional (removeEventListener: Source 1, Source 2, addEventListener (Source 1, Source 2).
Here is some background: I'm working on a Chrome Extension, and I decided to use Tippy.js. I found out this website I'm targeting, override window.EventTarget.prototype.removeEventListener
, and they access eventHandler.listener
without verifying it exists. I immediately thought it was their mistake (to assume it has value), but after reading about it, I found out this information is mandatory.
It's required, but the value can be undefined
. I'd say it's a problem of the website overriding a built-in function without adhering to the spec (never good practice), but I'm open to changing it to help compatibility in practice.
Bug description
The events
removeEventListener
andaddEventListener
oftransitionend
andwebkitTransitionEnd
are invoked with an undefined listener.dom-utils.ts / line 117
This function does not verify that "listener" is defined after being triggered from (createTippy.ts Line 411), that also didn't although it's an global variable that being defined only after its first run:
currentTransitionEndListener is a global var that is undefined at first load, so first call is always undefined.
Reproduction
CodePen link: https://codepen.io/lazycompiler/pen/rNYxBjQ