Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/microevent.js -- trigger() may reference undefined property #1856

Closed
rotdrop opened this issue Aug 18, 2022 · 0 comments
Closed

contrib/microevent.js -- trigger() may reference undefined property #1856

rotdrop opened this issue Aug 18, 2022 · 0 comments

Comments

@rotdrop
Copy link
Contributor

rotdrop commented Aug 18, 2022

I ran in a small problem when destroying the selectize instance an an on-change event handler. The reason is that

trigger: function(event /* , args... */){
this._events = this._events || {};
if (event in this._events === false) return;
for (var i = 0; i < this._events[event].length; i++){
this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
}
}

does not handle the case when the event-handler destroys the "this" object. In this case the "this" object is still there (as it is still referenced here), but its _events property is gone. See pull request #1855.

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

No branches or pull requests

2 participants