[Webkit-unassigned] [Bug 138129] New: String.prototype.split gives incorrect result in some cases: "a".split(/$/) == ["a", ""] not ["a"].
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Oct 28 02:44:21 PDT 2014
https://bugs.webkit.org/show_bug.cgi?id=138129
Bug ID: 138129
Summary: String.prototype.split gives incorrect result in some
cases: "a".split(/$/) == ["a",""] not ["a"].
Classification: Unclassified
Product: WebKit
Version: 528+ (Nightly build)
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: lrn at chromium.org
String.prototype.split gives an incorrect result in some cases.
When doing "a".split(/$/), the result is ["a", ""]. The result should be ["a"].
This was seen in Safari 7.1.
>From the es5 spec:
"The value of separator may be an empty String, an empty regular expression, or a regular expression that can match an empty String. In this case, separator does not match the empty substring at the beginning or end of the input String, nor does it match the empty substring at the end of the previous separator match."
In this case, the regexp can only match an empty substring at the end of the input, and by the above text, that match is ignored wrt. splitting, so the result should be the same as with no match, ["a"].
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20141028/6b2a9410/attachment-0001.html>
More information about the webkit-unassigned
mailing list