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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
var custom$ = function() {};
|
||||
window.$ = custom$;
|
||||
</script>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var map;
|
||||
|
||||
function test_$(t) {
|
||||
t.plan(1);
|
||||
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
|
||||
}
|
||||
|
||||
function test_Util_getImagesLocation (t) {
|
||||
t.plan( 1 );
|
||||
t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
|
||||
|
||||
Reference in New Issue
Block a user