javascript - Performance implications of unbinding all jQuery events on all elements -


I have a one-page "shell" application that can load several modules and I have many views in all the modules Do not know what controls or modules or ideas are loaded and can be customized (actions added / removed, DOM elements are added, etc.).

Since it is an SPA, so I want to unbind all events to avoid high memory usage or leaks while closing each scene but I do not know what kind of events are bound to So, on CloseView () , I am doing this:

  $ (this. Accessor + '*'). Unbind ();  

Which is essentially $ ('# myView *'). Unbind () - Attach all events to all page elements

Occasionally ~ 20 is the result of the selector in Dome Elements, but I have the 320 elements high

Edit for clarity:

Should I worry that choosing 300+ elements and canceling all events can cause performance issues?

It has been found that jQuery's $ ('# el'). Remove (); Removes all the events bound within that tree of #el , so it is essentially a non-issue. (Thanks for Kevinby for the answer)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -