Skip to content

Event listeners are never actually removed #423

Closed
@Aaronius

Description

@Aaronius

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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions