cache the result of the OpenLayers._getScriptLocation function. r=ahocevar (closes #2389)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9935 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2010-01-07 07:22:05 +00:00
parent 8a74ad8ed5
commit 871a790f3f

View File

@@ -17,6 +17,12 @@
*/
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
/**
* Cache for the script location returned from
* OpenLayers._getScriptLocation
*/
var scriptLocation;
/**
* Namespace: OpenLayers
* The OpenLayers object provides a namespace for all things OpenLayers
@@ -37,7 +43,10 @@
* {String} Path to this script
*/
_getScriptLocation: function () {
var scriptLocation = "";
if(scriptLocation) {
return scriptLocation;
}
scriptLocation = "";
var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
var scripts = document.getElementsByTagName('script');