1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 06:14:44 +00:00

Use string.charAt(n) instead of string[n]

Safari doesn't seem to like the string indices in some circumstances
This commit is contained in:
Jeremy Ruston 2013-02-05 19:12:05 +00:00
parent 5e6e03f3f3
commit 1b2cdf9cd0

View File

@ -241,15 +241,15 @@ Returns the new start position, after the parsed operation
function parseFilterOperation(operators,filterString,p) { function parseFilterOperation(operators,filterString,p) {
var operator, operand, bracketPos; var operator, operand, bracketPos;
// Skip the starting square bracket // Skip the starting square bracket
if(filterString[p++] !== "[") { if(filterString.charAt(p++) !== "[") {
throw "Missing [ in filter expression"; throw "Missing [ in filter expression";
} }
// Process each operator in turn // Process each operator in turn
do { do {
operator = {}; operator = {};
// Check for an operator prefix // Check for an operator prefix
if(filterString[p] === "!") { if(filterString.charAt(p) === "!") {
operator.prefix = filterString[p++]; operator.prefix = filterString.charAt(p++);
} }
// Get the operator name // Get the operator name
bracketPos = filterString.indexOf("[",p); bracketPos = filterString.indexOf("[",p);
@ -270,9 +270,9 @@ function parseFilterOperation(operators,filterString,p) {
p = bracketPos + 1; p = bracketPos + 1;
// Push this operator // Push this operator
operators.push(operator); operators.push(operator);
} while(filterString[p] !== "]"); } while(filterString.charAt(p) !== "]");
// Skip the ending square bracket // Skip the ending square bracket
if(filterString[p++] !== "]") { if(filterString.charAt(p++) !== "]") {
throw "Missing ] in filter expression"; throw "Missing ] in filter expression";
} }
// Return the parsing position // Return the parsing position