Remove all views in Document#remove().

This commit is contained in:
Jürg Lehni 2011-05-16 00:05:03 +01:00
parent 3a15360efc
commit abcba7deb4

View file

@ -78,6 +78,10 @@ var Document = this.Document = Base.extend({
remove: function() {
var res = Base.splice(this._scope.documents, null, this._index, 1);
this._scope = null;
// Remove all views. This also removes the event handlers installed for
// then.
for (var i = this.views.length - 1; i >= 0; i--)
this.views[i].remove();
return !!res.length;
},