"_getScriptLocation cannot handle query string". Patch originally by john.pulles@geodan.hl, improved by beau@beaugunderson.com. Thanks! r=crschmidt,me (closes #1263)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@5921 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2008-01-28 20:27:54 +00:00
parent 44f7ebdc22
commit 97ec46b15d

View File

@@ -43,9 +43,14 @@
var src = scripts[i].getAttribute('src'); var src = scripts[i].getAttribute('src');
if (src) { if (src) {
var index = src.lastIndexOf(scriptName); var index = src.lastIndexOf(scriptName);
// set path length for src up to a query string
var pathLength = src.lastIndexOf('?');
if (pathLength < 0) {
pathLength = src.length;
}
// is it found, at the end of the URL? // is it found, at the end of the URL?
if ((index > -1) && (index + scriptName.length == src.length)) { if ((index > -1) && (index + scriptName.length == pathLength)) {
scriptLocation = src.slice(0, -scriptName.length); scriptLocation = src.slice(0, pathLength - scriptName.length);
break; break;
} }
} }