From 405a2225e85bf71f4534dff0af50568594d6a415 Mon Sep 17 00:00:00 2001 From: Matt Priour Date: Mon, 5 Mar 2012 19:53:35 -0600 Subject: [PATCH 1/3] Make the getScriptLocation function work with mobile & light builds and any other extended OpenLayers script naming convention --- lib/OpenLayers/SingleFile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index 58ad019d37..e0167115fd 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -25,7 +25,7 @@ var OpenLayers = { * {String} Path to this script */ _getScriptLocation: (function() { - var r = new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\\?|$)"), + var r = new RegExp("(^|(.*?\\/))(OpenLayers.*?\.js)(\\?|$)"), s = document.getElementsByTagName('script'), src, m, l = ""; for(var i=0, len=s.length; i Date: Mon, 12 Mar 2012 09:05:54 +0100 Subject: [PATCH 2/3] use two slashes in RegExp strings for escapement (see http://stackoverflow.com/questions/7735749/fix-jslint-bad-escapement-warning-in-regex) --- lib/OpenLayers/SingleFile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index 478762aa9f..937ef23142 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -25,7 +25,7 @@ var OpenLayers = { * {String} Path to this script */ _getScriptLocation: (function() { - var r = new RegExp("(^|(.*?\\/))(OpenLayers.*?\.js)(\\?|$)"), + var r = new RegExp("(^|(.*?\\/))(OpenLayers.*?\\.js)(\\?|$)"), s = document.getElementsByTagName('script'), src, m, l = ""; for(var i=0, len=s.length; i Date: Mon, 12 Mar 2012 09:06:27 +0100 Subject: [PATCH 3/3] add tests for SingleFile._getScriptLocation --- tests/SingleFile1.html | 15 +++++++++++++++ tests/SingleFile2.html | 15 +++++++++++++++ tests/SingleFile3.html | 15 +++++++++++++++ tests/list-tests.html | 3 +++ 4 files changed, 48 insertions(+) create mode 100644 tests/SingleFile1.html create mode 100644 tests/SingleFile2.html create mode 100644 tests/SingleFile3.html diff --git a/tests/SingleFile1.html b/tests/SingleFile1.html new file mode 100644 index 0000000000..32cbad6830 --- /dev/null +++ b/tests/SingleFile1.html @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/tests/SingleFile2.html b/tests/SingleFile2.html new file mode 100644 index 0000000000..5fc9248058 --- /dev/null +++ b/tests/SingleFile2.html @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/tests/SingleFile3.html b/tests/SingleFile3.html new file mode 100644 index 0000000000..557952c233 --- /dev/null +++ b/tests/SingleFile3.html @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/tests/list-tests.html b/tests/list-tests.html index 61b19a1eea..cef96a4dd7 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -182,6 +182,9 @@
  • OpenLayers3.html
  • OpenLayers4.html
  • OpenLayersJsFiles.html
  • +
  • SingleFile1.html +
  • SingleFile2.html +
  • SingleFile3.html
  • Popup.html
  • Popup/Anchored.html
  • Popup/AnchoredBubble.html