diff options
author | kpdecker <kpdecker@gmail.com> | 2013-12-23 02:18:57 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-12-23 02:18:57 -0600 |
commit | 3daef9d30897a7cca7a471ad5f21b955ff54b131 (patch) | |
tree | e231b1518a1143c6d63567e1fac369bb9c7c27de | |
parent | 7f0ded4926be2f5c574e9a3d2187f85f0e0c5bbc (diff) | |
download | handlebars.js-3daef9d30897a7cca7a471ad5f21b955ff54b131.zip handlebars.js-3daef9d30897a7cca7a471ad5f21b955ff54b131.tar.gz handlebars.js-3daef9d30897a7cca7a471ad5f21b955ff54b131.tar.bz2 |
Use charAt rather than string index
Older versions of IE do not support [] access to string contents so charAt must be used.
Fixes #677
-rw-r--r-- | lib/handlebars/compiler/ast.js | 3 | ||||
-rw-r--r-- | 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 b059cc1..e8cde74 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 71a8575..93797f5 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) === '~' }; } |