From 3daef9d30897a7cca7a471ad5f21b955ff54b131 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Mon, 23 Dec 2013 02:18:57 -0600 Subject: [PATCH] Use charAt rather than string index Older versions of IE do not support [] access to string contents so charAt must be used. Fixes #677 --- lib/handlebars/compiler/ast.js | 3 ++- src/handlebars.yy | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index b059cc183..e8cde74e1 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -19,7 +19,8 @@ var AST = { this.hash = hash; this.strip = strip; - var escapeFlag = open[3] || open[2]; + // Must use charAt to support IE pre-10 + var escapeFlag = open.charAt(3) || open.charAt(2); this.escaped = escapeFlag !== '{' && escapeFlag !== '&'; var id = this.id = rawParams[0]; diff --git a/src/handlebars.yy b/src/handlebars.yy index 71a857546..93797f5ae 100644 --- a/src/handlebars.yy +++ b/src/handlebars.yy @@ -6,8 +6,8 @@ function stripFlags(open, close) { return { - left: open[2] === '~', - right: close[0] === '~' || close[1] === '~' + left: open.charAt(2) === '~', + right: close.charAt(0) === '~' || close.charAt(1) === '~' }; }