Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid adding a DisplayList to itself

  • Loading branch information...
commit 4788596c7835ab832985b058a724ab5ee9dda6e0 1 parent 20ef946
@basecode basecode authored
View
1  CHANGELOG
@@ -15,6 +15,7 @@ v0.3.4
* Modify "simple" Animation example movie
* Change `Animation#play` signature (Remove parameters)
* Fix pattern (used for fill images / gradients) translation (tx/ty) values in the renderer
+* Avoid adding a DisplayList to itself
v0.3.3
-------------------
View
5 src/runner/display_list.js
@@ -46,6 +46,11 @@ define([
return this;
}
+ // Avoid adding a displaylist to itself
+ if (this === child) {
+ return this;
+ }
+
var stage = this.stage;
if (child.parent) {
View
7 test/display_list-spec.js
@@ -93,6 +93,12 @@ require([
expect(dl.children()).toEqual([a1, c1, c2, c3, a2]);
});
+ it('Avoid adding a displaylist to itself', function() {
+ var dl = createDisplayList();
+ dl.addChild(dl);
+ expect(dl.children().length).toBe(0);
+ });
+
it('Adds child to registry::displayObjects', function() {
var dl = createDisplayList(),
@@ -230,6 +236,7 @@ require([
expect(fifth.next).toBeUndefined();
});
});
+
});
describe('getIndexOfChild', function() {
Please sign in to comment.
Something went wrong with that request. Please try again.