Fix IE 8 compatibility
This commit is contained in:
parent
ab145f1af7
commit
c00820c128
|
@ -54,12 +54,9 @@ Zotero_TranslatorTester = function(translator, type, debug) {
|
||||||
var testStart = code.indexOf("/** BEGIN TEST CASES **/");
|
var testStart = code.indexOf("/** BEGIN TEST CASES **/");
|
||||||
var testEnd = code.indexOf("/** END TEST CASES **/");
|
var testEnd = code.indexOf("/** END TEST CASES **/");
|
||||||
if (testStart !== -1 && testEnd !== -1) {
|
if (testStart !== -1 && testEnd !== -1) {
|
||||||
var test = code.substring(testStart + 24, testEnd);
|
var test = code.substring(testStart + 24, testEnd)
|
||||||
test = test.replace(/var testCases = /,'').trim();
|
.replace(/^[\s\r\n]*var testCases = /, '')
|
||||||
// The JSON parser doesn't like final semicolons
|
.replace(/;[\s\r\n]*$/, '');
|
||||||
if (test.lastIndexOf(';') == (test.length-1)) {
|
|
||||||
test = test.slice(0,-1);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
var testObject = JSON.parse(test);
|
var testObject = JSON.parse(test);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user