added fix for IE9

This commit is contained in:
Eric Rowell
2012-03-11 15:57:57 -07:00
parent 1f0585549b
commit 5aee56ab5e
4 changed files with 33 additions and 27 deletions

View File

@@ -3,7 +3,7 @@
* http://www.kineticjs.com/ * http://www.kineticjs.com/
* Copyright 2012, Eric Rowell * Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Mar 10 2012 * Date: Mar 11 2012
* *
* Copyright (C) 2011 - 2012 by Eric Rowell * Copyright (C) 2011 - 2012 by Eric Rowell
* *
@@ -730,7 +730,7 @@ Kinetic.Container.prototype = {
* and then readd all the layers * and then readd all the layers
*/ */
if(this.className === "Stage") { if(this.className === "Stage") {
var canvases = this.container.childNodes; var canvases = this.container.children;
var bufferCanvas = canvases[0]; var bufferCanvas = canvases[0];
var backstageCanvas = canvases[1]; var backstageCanvas = canvases[1];

File diff suppressed because one or more lines are too long

View File

@@ -85,7 +85,7 @@ Kinetic.Container.prototype = {
* and then readd all the layers * and then readd all the layers
*/ */
if(this.className === "Stage") { if(this.className === "Stage") {
var canvases = this.container.childNodes; var canvases = this.container.children;
var bufferCanvas = canvases[0]; var bufferCanvas = canvases[0];
var backstageCanvas = canvases[1]; var backstageCanvas = canvases[1];

View File

@@ -95,6 +95,34 @@ function Test() {
stage.draw(); stage.draw();
}, },
"STAGE - remove layer with shape": function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: stage.width / 2,
y: stage.height / 2,
radius: 70,
fill: "green",
stroke: "black",
strokeWidth: 4,
name: "myCircle"
});
layer.add(circle);
stage.add(layer);
test(stage.children.length === 1, "stage should have 1 children");
stage.remove(layer);
test(stage.children.length === 0, "stage should have 0 children");
},
"STAGE - remove layer with no shapes": function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
stage.add(layer);
stage.remove(layer);
},
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// LAYERS tests // LAYERS tests
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@@ -135,28 +163,6 @@ function Test() {
test(layer.children.length === 0, "layer should have 0 children"); test(layer.children.length === 0, "layer should have 0 children");
}, },
"LAYERS - remove layer": function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: stage.width / 2,
y: stage.height / 2,
radius: 70,
fill: "green",
stroke: "black",
strokeWidth: 4,
name: "myCircle"
});
layer.add(circle);
stage.add(layer);
test(stage.children.length === 1, "stage should have 1 children");
stage.remove(layer);
test(stage.children.length === 0, "stage should have 0 children");
},
"LAYERS - hide layer": function(containerId) { "LAYERS - hide layer": function(containerId) {
var stage = new Kinetic.Stage(containerId, 578, 200); var stage = new Kinetic.Stage(containerId, 578, 200);
var layer = new Kinetic.Layer(); var layer = new Kinetic.Layer();