You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.
From a code inspection, Foundation.unsubscribe(name, callback) removes ALL listeners for the specified name. This works as intended in the case where 'name' is the ID of a specific element (for example, in modal.js or notification.js). However, the subscribe/unsubscribe mechanism is also used for the global 'resize' event. In several places in the codebase, Foundation.unsubscribe('resize') is used. This will detach ALL listeners of the resize event, not just the intended listener (e.g interchange.js line 233).
In addition, in iconic.js, the zfIconic directive subscribes to 'resize' but does not 'unsubscribe' when it is destroyed. This will lead to leaking of detached DOM elements.
The Foundation.unsubscribe method should be changed to allow un-subscription of a specific listener and all subscriptions should be checked for matching un-subscriptions to prevent leaks.
The text was updated successfully, but these errors were encountered:
You can demonstrate the leak from zfIconic by using the Chrome Dev timeline while viewing http://foundation.zurb.com/apps/docs and repeatedly switching between the Iconic tab and the Typography tab.
I've gone through the entire codebase and wrote an unsubscribed method for every subscribe method. Feel free to run the same analytics against v1.2.5 and create issues as needed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
From a code inspection, Foundation.unsubscribe(name, callback) removes ALL listeners for the specified name. This works as intended in the case where 'name' is the ID of a specific element (for example, in modal.js or notification.js). However, the subscribe/unsubscribe mechanism is also used for the global 'resize' event. In several places in the codebase, Foundation.unsubscribe('resize') is used. This will detach ALL listeners of the resize event, not just the intended listener (e.g interchange.js line 233).
In addition, in iconic.js, the zfIconic directive subscribes to 'resize' but does not 'unsubscribe' when it is destroyed. This will lead to leaking of detached DOM elements.
The Foundation.unsubscribe method should be changed to allow un-subscription of a specific listener and all subscriptions should be checked for matching un-subscriptions to prevent leaks.
The text was updated successfully, but these errors were encountered: