Fix jsparse tests on IE7.

This commit is contained in:
David Glasser
2012-09-28 12:39:03 -07:00
parent 2495cb2f58
commit 4dcdeb4435

View File

@@ -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;
};