[API] Throw error on containment violation

This commit is contained in:
Victor Woeltjen 2016-08-12 09:30:02 -07:00
parent 11409ce509
commit 1de26d3c5d

View File

@ -52,6 +52,9 @@ define([
if (!this._children) {
throw new Error("Must load composition before you can add!");
}
if (!this.canContain(child)) {
throw new Error("This object cannot contain that object.");
}
if (this.contains(child)) {
if (skipMutate) {
return; // don't add twice, don't error.