From 2dc08ccab82b73571518c2655ebf0fc722fbc692 Mon Sep 17 00:00:00 2001 From: Marc Harter Date: Wed, 9 Jan 2013 20:41:31 -0600 Subject: [PATCH] fixed; appendChild of null error GH #36 --- humane.js | 3 ++- test/issue36.html | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/issue36.html diff --git a/humane.js b/humane.js index 371928b..cbc32f9 100644 --- a/humane.js +++ b/humane.js @@ -53,7 +53,7 @@ this.waitForMove = o.waitForMove || false this.clickToClose = o.clickToClose || false this.forceNew = o.forceNew || false - this.container = o.container || doc.body + this.container = o.container try { this._setupEl() } // attempt to setup elements catch (e) { @@ -66,6 +66,7 @@ _setupEl: function () { var el = doc.createElement('div') el.style.display = 'none' + if (!this.container) this.container = doc.body this.container.appendChild(el) this.el = el this.removeEvent = ENV.bind(this.remove,this) diff --git a/test/issue36.html b/test/issue36.html new file mode 100644 index 0000000..437f93d --- /dev/null +++ b/test/issue36.html @@ -0,0 +1,9 @@ + + + + + + +