String.prototype.search has a breaking change from ES5
allen at wirfs-brock.com
Sun Apr 19 18:45:03 UTC 2015
On Apr 18, 2015, at 12:46 PM, Yusuke SUZUKI wrote:
> Hi forks,
> Seeing ES6 String.prototype.search, there's a breaking change from ES5.
> When executing `"gnulluna".search(null)`,
> In ES5, RegExp(null) => /null/ is generated, so the result becomes 1.
> In ES6, we fall down to the 126.96.36.199 step 3 (because null is not undefined).
> And then reaching step 3.a,
> Let searcher be GetMethod(regexp, @@search).
> Then TypeError is thrown by GetV's ToObject.
> Is it intentional behavior?
Appears to be a bug. Probably also for similar code for match, replace, and split.
Please file a bug ticket.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss