Allow user to specify what the containing element should be when creating a new instance. #32

Merged
merged 1 commit into from Nov 19, 2012

Conversation

Projects
None yet
4 participants
Contributor

jisaacks commented Nov 9, 2012

Right now it is always added to the body element. I wanted to add it to another element.

Usage:

inhumane = humane.create({container: $("#my_other_element")[0]})
inhumane.log("Displaying inside a different element!!")

wavded added a commit that referenced this pull request Nov 19, 2012

Merge pull request #32 from jisaacks/master
Allow user to specify what the containing element should be when creating a new instance.

@wavded wavded merged commit 0df0805 into wavded:master Nov 19, 2012

Owner

wavded commented Nov 19, 2012

my favorite part of this pull is the inhumane variable name :) i'm cool with adding this. thanks!

In my case (google chrome 23) doc.body is always null, thus, I get an error when trying, later, to call this.container.appendChild()

Contributor

jisaacks replied Dec 5, 2012

@fcamblor doc is set to document on line 16:

var doc = document

Is document returning null in your case as well? I am just wondering if document is not set for you or if doc is out of scope for you. It works for me on Chrome, doc was also being used originally.

Ran into the same problem trying to get Humane working in a largish app. It's likely because the constructor reschedules _setupEl if the DOM isn't loaded and by then doc.body is no longer null. But in this version if the dom isn't loaded the constructor records the null doc.body into this.container and only ever uses that value in _setupEl.

Contributor

jisaacks replied Apr 4, 2013

@andyprime a lil late but this issue looks to be fixed from this commit 2dc08cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment