diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index ef70133a..8f169def 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -69,16 +69,16 @@ dom.importCssString(editorCss, "ace_editor"); var VirtualRenderer = function(container, theme) { var _self = this; - this.container = container; + this.container = container || dom.createElement("div"); // TODO: this breaks rendering in Cloud9 with multiple ace instances -// // Imports CSS once per DOM document ('ace_editor' serves as an identifier). -// dom.importCssString(editorCss, "ace_editor", container.ownerDocument); + // // Imports CSS once per DOM document ('ace_editor' serves as an identifier). + // dom.importCssString(editorCss, "ace_editor", container.ownerDocument); // in IE <= 9 the native cursor always shines through this.$keepTextAreaAtCursor = !useragent.isIE; - dom.addCssClass(container, "ace_editor"); + dom.addCssClass(this.container, "ace_editor"); this.setTheme(theme); @@ -113,7 +113,7 @@ var VirtualRenderer = function(container, theme) { this.$animatedScroll = false; - this.scrollBar = new ScrollBar(container); + this.scrollBar = new ScrollBar(this.container); this.scrollBar.addEventListener("scroll", function(e) { if (!_self.$inScrollAnimation) _self.session.setScrollTop(e.data);