make _getScriptLocation RegExp more robust, p=jpfiset, t,r=me
This commit is contained in:
@@ -25,7 +25,7 @@ var OpenLayers = {
|
|||||||
* {String} Path to this script
|
* {String} Path to this script
|
||||||
*/
|
*/
|
||||||
_getScriptLocation: (function() {
|
_getScriptLocation: (function() {
|
||||||
var r = new RegExp("(^|(.*?\\/))(OpenLayers.*?\\.js)(\\?|$)"),
|
var r = new RegExp("(^|(.*?\\/))(OpenLayers[^\\/]*?\\.js)(\\?|$)"),
|
||||||
s = document.getElementsByTagName('script'),
|
s = document.getElementsByTagName('script'),
|
||||||
src, m, l = "";
|
src, m, l = "";
|
||||||
for(var i=0, len=s.length; i<len; i++) {
|
for(var i=0, len=s.length; i<len; i++) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="some/path/OpenLayers.js"></script>
|
<script src="some/OpenLayers/path/OpenLayers.js"></script>
|
||||||
<script src="../lib/OpenLayers/SingleFile.js"></script>
|
<script src="../lib/OpenLayers/SingleFile.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function test_OpenLayers(t) {
|
function test_OpenLayers(t) {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
t.eq(OpenLayers._getScriptLocation(), "some/path/",
|
t.eq(OpenLayers._getScriptLocation(), "some/OpenLayers/path/",
|
||||||
"Script location correctly detected (OpenLayers.js).");
|
"Script location correctly detected (OpenLayers.js).");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="some/path/OpenLayers.light.js"></script>
|
<script src="some/OpenLayers/path/OpenLayers.light.js"></script>
|
||||||
<script src="../lib/OpenLayers/SingleFile.js"></script>
|
<script src="../lib/OpenLayers/SingleFile.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function test_OpenLayers(t) {
|
function test_OpenLayers(t) {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
t.eq(OpenLayers._getScriptLocation(), "some/path/",
|
t.eq(OpenLayers._getScriptLocation(), "some/OpenLayers/path/",
|
||||||
"Script location correctly detected (OpenLayers.light.js)<29>.");
|
"Script location correctly detected (OpenLayers.light.js)<29>.");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="some/path/OpenLayers.light.debug.js"></script>
|
<script src="some/OpenLayers/path/OpenLayers.light.debug.js"></script>
|
||||||
<script src="../lib/OpenLayers/SingleFile.js"></script>
|
<script src="../lib/OpenLayers/SingleFile.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function test_OpenLayers(t) {
|
function test_OpenLayers(t) {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
t.eq(OpenLayers._getScriptLocation(), "some/path/",
|
t.eq(OpenLayers._getScriptLocation(), "some/OpenLayers/path/",
|
||||||
"Script location correctly detected (OpenLayers.light.debug.js).");
|
"Script location correctly detected (OpenLayers.light.debug.js).");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user