[OpenLayers-Commits] r11196 - trunk/openlayers/tests
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Feb 21 10:39:14 EST 2011
Author: pgiraud
Date: 2011-02-21 07:39:14 -0800 (Mon, 21 Feb 2011)
New Revision: 11196
Modified:
trunk/openlayers/tests/OLLoader.js
Log:
Putting the loader code into an self-executed function so that we don't have problems with global scope variables, Closes #3076
Modified: trunk/openlayers/tests/OLLoader.js
===================================================================
--- trunk/openlayers/tests/OLLoader.js 2011-02-21 15:32:40 UTC (rev 11195)
+++ trunk/openlayers/tests/OLLoader.js 2011-02-21 15:39:14 UTC (rev 11196)
@@ -1,25 +1,26 @@
// Adding a mode parameter with "build" as value in the run-tests.html will
// make usage of the build version of the library.
// get the OLLoader.js script location
-
-var r = new RegExp("(^|(.*?\\/))(" + "OLLoader.js" + ")(\\?|$)"),
- s = document.getElementsByTagName('script'),
- src, m, l = "";
-for(var i=0, len=s.length; i<len; i++) {
- src = s[i].getAttribute('src');
- if(src) {
- var m = src.match(r);
- if(m) {
- l = m[1];
- break;
+(function() {
+ var r = new RegExp("(^|(.*?\\/))(" + "OLLoader.js" + ")(\\?|$)"),
+ s = document.getElementsByTagName('script'),
+ src, m, l = "";
+ for(var i=0, len=s.length; i<len; i++) {
+ src = s[i].getAttribute('src');
+ if(src) {
+ var m = src.match(r);
+ if(m) {
+ l = m[1];
+ break;
+ }
}
}
-}
-var regex = new RegExp( "[\\?&]mode=([^&#]*)" );
-var href = window.parent.location.href;
-var results = regex.exec( href );
-l += (results && results[1] == 'build') ?
- "../build/OpenLayers.js" : "../lib/OpenLayers.js";
-scriptTag = "<script src='" + l + "'></script>";
-document.write(scriptTag);
+ var regex = new RegExp( "[\\?&]mode=([^&#]*)" );
+ var href = window.parent.location.href;
+ var results = regex.exec( href );
+ l += (results && results[1] == 'build') ?
+ "../build/OpenLayers.js" : "../lib/OpenLayers.js";
+ scriptTag = "<script src='" + l + "'></script>";
+ document.write(scriptTag);
+})();
More information about the Commits
mailing list