From 20ff66cf04e1f8f3186e78c74741a0e38d148c4f Mon Sep 17 00:00:00 2001 From: Robert Krahn Date: Sat, 16 Mar 2013 17:58:39 -0700 Subject: [PATCH] [incremental search] using dom.importCssString --- lib/ace/incremental_search.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/ace/incremental_search.js b/lib/ace/incremental_search.js index e158b6d5..c7227cdc 100644 --- a/lib/ace/incremental_search.js +++ b/lib/ace/incremental_search.js @@ -186,23 +186,15 @@ exports.IncrementalSearch = IncrementalSearch; * **/ +var dom = require('./lib/dom'); function patchHighlightMarkerStyling(options) { options = options || {}; var id = 'incremental-search-highlight-style-patch', - style = document.getElementById(id); - if (style) { - if (options.enable) return; - style.parentNode.removeChild(style); - return; - } - if (!options.enable) return; - style = document.createElement('style'); - style.setAttribute('id', id); - style.textContent = "div.ace_selected-word {\n" - + " background-color: orange !important;\n" - + " border: 0 !important;" - + "}\n" - document.getElementsByTagName('head')[0].appendChild(style); + css = 'div.ace_selected-word {\n' + + ' background-color: orange !important;\n' + + ' border: 0 !important;\n' + + '}\n' + dom.importCssString(css, id); }