craftyjs/Crafty — pull request #442 by smartboyathome (2013-04-08 02:57:48+00:00)
Title: Make the stage element (#cr-stage) more modular

I needed to have Crafty use an element other than a div with id 'cr-stage', and I noticed that the support for a modular stage element was already there with Crafty.stage.elem, but there were a couple references to 'cr-stage' still in the code. I updated Crafty.init(w, h) and Crafty.viewport.init(w, h) to take an optional stage_elem parameter that could be either a string or an HTMLElement (known as just an Element in IE8). If no parameter is given, it defaults to the original behavior of finding an element with id cr-stage and, if none exists, creating it under 'body'. In addition to this, I updated the stop function to set the id of the replacement div for stage with the id from the original stage element. Please look it over and let me know what you think.