Group.isEmpty

This commit is contained in:
Michael Yoshitaka Erlewine 2010-07-03 17:55:19 -04:00
parent 1927ab2f59
commit b52289b78b
2 changed files with 8 additions and 2 deletions

View File

@ -253,9 +253,8 @@ Drag.prototype = {
Trenches.hideGuides();
this.item.isDragging = false;
// TODO: create a Group.isEmpty instead.
if (this.parent && !this.parent.locked.close && this.parent != this.item.parent
&& this.parent._children.length == 0 && !this.parent.getTitle()) {
&& this.parent.isEmpty()) {
this.parent.close();
}

View File

@ -362,6 +362,13 @@ window.Group.prototype = iQ.extend(new Item(), new Subscribable(), {
return data;
},
// ----------
// Function: isEmpty
// Returns true if the tab group is empty and unnamed.
isEmpty: function() {
return this._children.length == 0 && !this.getTitle();
},
// ----------
// Function: save
// Saves this group to persistant storage.