From 792c0fa390fe23efcf98049a14b8e3880987bf30 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 10 May 2016 22:55:35 -0400 Subject: randomly slide the canvas --- js/matrix.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/matrix.js') diff --git a/js/matrix.js b/js/matrix.js index de59e17..1aeb929 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -58,7 +58,7 @@ Matrix.prototype.demolish = function (){ this.forEach(function(lex){ lex.demolish() }) - while (this.rapper.firstChild) { + while (this.rapper && this.rapper.firstChild) { this.rapper.removeChild(this.rapper.firstChild); } this.aa.forEach(function(row){ @@ -124,6 +124,7 @@ Matrix.prototype.build = function(){ } Matrix.prototype.append = function(rapper){ rapper = this.rapper = rapper || this.rapper + if (! this.rapper) return this.aa.forEach(function(row, y){ var div = document.createElement("div") row.forEach(function(lex, x) { -- cgit v1.2.3-70-g09d2