Permalink
Browse files

Update `importCssString` so that it can work with remote DOM documents.

  • Loading branch information...
1 parent e5aa00f commit 190ed05eae70656d665e99e05cd2db0ece244ae9 @Gozala Gozala committed Sep 9, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/ace/virtual_renderer.js
@@ -53,11 +53,11 @@ var RenderLoop = require("ace/renderloop").RenderLoop;
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var editorCss = require("ace/requirejs/text!ace/css/editor.css");
-// import CSS once
-dom.importCssString(editorCss);
-
var VirtualRenderer = function(container, theme) {
this.container = container;
+
+ // Imports CSS once per DOM document ('ace_editor' serves as an identifier).
+ dom.importCssString(editorCss, "ace_editor", container.ownerDocument);
dom.addCssClass(this.container, "ace_editor");
this.setTheme(theme);
@@ -803,6 +803,12 @@ var VirtualRenderer = function(container, theme) {
}
function afterLoad(theme) {
+ dom.importCssString(
+ theme.cssText,
+ theme.cssClass,
+ _self.container.ownerDocument
+ );
+
if (_self.$theme)
dom.removeCssClass(_self.container, _self.$theme);

0 comments on commit 190ed05

Please sign in to comment.