Closed
Description
In my particular case, I'm trying to disable auto-resizing from the iframe using window.parentIframe.autoResize(false);
but it remains enabled. The reason is because the logic to remove event listeners isn't correct.
Take a look at manageEventListeners
which is called by autoResize()
. It calls manageTriggerEvent
multiple times. Each time manageTriggerEvent
is called, manageTriggerEvent
re-creates the handleEvent
function meaning that when it actually goes to remove the event listener, the handleEvent
function being passed to removeEventListener
is not the same handleEvent
function that was passed to addEventListener
when the event listener was added. Because they are different functions, the event listener removal doesn't actually succeed.