Comments (2)
To confirm I understand the problem, I tried to call this from leave() on the view, but that did not work.
means code similar to the following?
var NodeView = CompositeView.extend({
render: function() {
this.$el.plugin();
},
leave: function() {
this.$el.plugin("destroy");
CompositeView.prototype.leave.call(this);
}
});
var parent = new NodeView();
var child = new NodeView();
parent.appendChild(child);
// `.plugin("destroy")` in custom `leave()` does not work when called by `child`
parent.leave();
If so, we can change the order. From git history the current order is how the methods were added.
from backbone-support.
@ecbypi yes that's the case. The issue is that jQuery plugins, such as typeahead, bootstrap-timepicker and many others, are not destroyed properly.
Reason is that when adding anything to the DOM using jQuery, jQuery saves a reference to that item event listeners. That data is stored under $.cache (what's $.cache?).
The problem is that even when I try to use destroy on the leave method, the event listeners are not removed as their bound element is not in the DOM anymore, which it turn create a memory leak.
When calling _leaveChildren()
before remove()
, the leak is prevented.
leave: function() {
this.trigger('leave');
this.unbind();
this.stopListening();
this._leaveChildren();
this.remove();
this._removeFromParent();
},
make it all makes sense :)
from backbone-support.
Related Issues (8)
- Different behaviour Chrome and Firefox when using prop('selectedIndex',-1) HOT 3
- [enhancement] Add missing bower.json.
- Explain if this library is still supported HOT 6
- Deprecation warning - unbindFromAll HOT 4
- The page needs to be reload to access new model data in composite view HOT 3
- Class inheritance is overkill HOT 5
- declaring global Support will fail in strict mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone-support.