Index: src/string.js |
diff --git a/src/string.js b/src/string.js |
index 297105d0474fa73d1653f9ffbc582b49c45a6624..9bc8e850364d96469d66dd4d0c195ac2b891dc6d 100644 |
--- a/src/string.js |
+++ b/src/string.js |
@@ -568,7 +568,6 @@ function StringSplit(separator, limit) { |
} |
var subject = TO_STRING_INLINE(this); |
limit = (IS_UNDEFINED(limit)) ? 0xffffffff : TO_UINT32(limit); |
- if (limit === 0) return []; |
// ECMA-262 says that if separator is undefined, the result should |
// be an array of size 1 containing the entire string. SpiderMonkey |
@@ -582,6 +581,9 @@ function StringSplit(separator, limit) { |
var length = subject.length; |
if (!IS_REGEXP(separator)) { |
separator = TO_STRING_INLINE(separator); |
+ |
+ if (limit === 0) return []; |
+ |
var separator_length = separator.length; |
// If the separator string is empty then return the elements in the subject. |
@@ -591,6 +593,8 @@ function StringSplit(separator, limit) { |
return result; |
} |
+ |
+ if (limit === 0) return []; |
%_Log('regexp', 'regexp-split,%0S,%1r', [subject, separator]); |