From 6b6ca2a1253cb27a2922c4becba63b7afb54788d Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 21 May 2009 00:17:20 +0000 Subject: [PATCH] Take care not to clobber any previously set window.$ value. IE, in its mysterious ways, sets $ to undefined if we have a conditional 'var $ = somefunc;' expression - even if the condition evaluates to false. Problem does not occur if expression is 'window.$ = somefunc;'. This makes OL play nicely with jQuery (among others) in IE. r=crschmidt (pullup #1391) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9400 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 6 +++--- tests/Util.html | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 5709773a1a..8d63340d1e 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -32,10 +32,10 @@ OpenLayers.Util.getElement = function() { }; /** - * Maintain $() from prototype + * Maintain existing definition of $. */ -if ($ == null) { - var $ = OpenLayers.Util.getElement; +if(typeof window.$ === "undefined") { + window.$ = OpenLayers.Util.getElement; } /** diff --git a/tests/Util.html b/tests/Util.html index 9d0982933c..4ad9a59d6a 100644 --- a/tests/Util.html +++ b/tests/Util.html @@ -1,10 +1,19 @@ +