From 4dcdeb44350e2a547d6f924dacaeeaa98d1fc672 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Fri, 28 Sep 2012 12:39:03 -0700 Subject: [PATCH] Fix jsparse tests on IE7. --- packages/jsparse/lexer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/jsparse/lexer.js b/packages/jsparse/lexer.js index c62e2c6bd4..95cef2d179 100644 --- a/packages/jsparse/lexer.js +++ b/packages/jsparse/lexer.js @@ -325,7 +325,9 @@ JSLexer.prototype.next = function () { if (match && (match.index !== pos)) match = null; // Record the end position of the match back into `pos`. - if (match) + // Avoid an IE7 bug where lastIndex is incremented when + // the match has 0 length. + if (match && match[0].length !== 0) pos = regex.lastIndex; return match; };