Modifying the loader script to check more carefully for the location of OpenLayers.js - allowing folks to have scripts called things like foo-OpenLayers.js. r=crschmidt (closes #1888)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9086 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+17
-12
@@ -1,19 +1,24 @@
|
||||
<html>
|
||||
<head>
|
||||
<script id="script" src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
function test_OpenLayers(t) {
|
||||
t.plan(2);
|
||||
|
||||
var script = document.getElementById("script");
|
||||
<script src="bogus/1/OpenLayers.js-foo"></script>
|
||||
<script src="bogus/2/foo-OpenLayers.js"></script>
|
||||
<script id="script" src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
function test_OpenLayers(t) {
|
||||
t.plan(3);
|
||||
|
||||
t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
|
||||
|
||||
script.setAttribute("src", "../lib/OpenLayers.js?foo");
|
||||
t.eq(OpenLayers._getScriptLocation(), "../", "Script location with search string correctly detected.");
|
||||
}
|
||||
var script = document.getElementById("script");
|
||||
|
||||
</script>
|
||||
t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
|
||||
script.setAttribute("src", "../lib/OpenLayers.js?foo");
|
||||
t.eq(OpenLayers._getScriptLocation(), "../", "Script location with search string correctly detected.");
|
||||
|
||||
// now pretend we're using a built script
|
||||
OpenLayers._scriptName = "OpenLayers.js";
|
||||
t.eq(OpenLayers._getScriptLocation(), "../lib/", "not fooled by bogus paths");
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user