From 4d5291c340537869e967ca44120be5905bf9ba24 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 4 Dec 2013 17:21:27 +0100 Subject: [PATCH] clean up Ox.PATH --- source/Ox/js/Constants.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/Ox/js/Constants.js b/source/Ox/js/Constants.js index 10ed071e..68fcdabd 100644 --- a/source/Ox/js/Constants.js +++ b/source/Ox/js/Constants.js @@ -90,11 +90,12 @@ Ox.SHORT_MONTHS = Ox.MONTHS.map(function(val) { //@ Ox.PATH Path of Ox.js Ox.PATH = (function() { // IE8 can't apply slice to NodeLists, see Ox.slice - var index, scripts = document.getElementsByTagName('script'); + var index, regexp = /Ox\.js(\?\d+|)$/, + scripts = document.getElementsByTagName('script'), src; for (index = scripts.length - 1; index >= 0; index--) { - var src = scripts[index].src; - if (/Ox\.js(\?\d+|)$/.test(src)) { - return src.replace(/Ox\.js(\?\d+|)$/, ''); + src = scripts[index].src; + if (regexp.test(src)) { + return src.replace(regexp, ''); } } }());