Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

memory leak #474

Open
javid-p84 opened this issue Jan 16, 2019 · 0 comments
Open

memory leak #474

javid-p84 opened this issue Jan 16, 2019 · 0 comments

Comments

@javid-p84
Copy link

this piece has a memory leak where if user navigates through different pages , the hook to the click event does not die. So we will be adding a new event each time for each control. Especially for SPAs, this is a big issue. I have a simple fix for it and can make a PR if you let me.

if (scope.settings.closeOnBlur) {
$document.on('click', function (e) {

var target = e.target.parentElement;
var parentFound = false;

                while (angular.isDefined(target) && target !== null && !parentFound) {
                    if (_.contains(target.className.split(' '), 'multiselect-parent') && !parentFound) {
                        if (target === $dropdownTrigger) {
                            parentFound = true;
                        }
                    }
                    target = target.parentElement;
                }

                if (!parentFound) {
                    scope.$apply(function () {
                        var bWasopen = false;
                        if (scope.open) bWasopen = true;
                        scope.open = false;
                        if (bWasopen) scope.externalEvents.onBlur();
                    });
                }
            });

        }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant