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"].
<rdar://problem/18807403>
Created attachment 245088 [details] Updated split such that it does not include the empty end of line string.
Patch landed: http://trac.webkit.org/changeset/178860 Closing bug.