From acfdb0ec17941f6c56aa6d7ce0d136e690422ec8 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Mon, 21 Jun 2010 11:43:35 -0400 Subject: [PATCH] Always use document.write to output script tags, regardless of useragent. inserting scripts into the dom breaks things when using horde's static javascript caching. --- horde/js/hordemap/map.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/horde/js/hordemap/map.js b/horde/js/hordemap/map.js index a51169a1f..65f650358 100644 --- a/horde/js/hordemap/map.js +++ b/horde/js/hordemap/map.js @@ -72,25 +72,14 @@ HordeMap = { _includeScripts: function() { var files = this._includes; - var agent = navigator.userAgent; - var docWrite = (agent.match("MSIE") || agent.match("Safari")); + + // Need to use document.write instead of inserting into DOM directly + // to play nice with horde's javascript caching/loading var writeFiles = []; for (var i = 0, len = files.length; i < len; i++) { - if (docWrite) { - writeFiles.push(''); - } else { - var s = document.createElement("script"); - s.src = files[i]; - var h = document.getElementsByTagName("head").length ? - document.getElementsByTagName("head")[0] : - document.body; - h.appendChild(s); - } - } - - if (docWrite) { - document.write(writeFiles.join("")); + writeFiles.push(''); } + document.write(writeFiles.join("")); }, _addScript: function(s) -- 2.11.0