paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 388 forks source link

String.prototype.search fails when given regex #394

Closed baardsen closed 8 years ago

baardsen commented 8 years ago

In version 0.34.0 'a'.search(/a/) returns -1 instead of the expected 0. If given a string (i.e. 'a'.search('a')) then search successfully returns 0. Error is not present in version 0.33.13.

Tested that the error is reproducible in Chrome 49.0.2593.0 dev-m, Firefox 43.0.2 and MS Edge 25.10586.0.0. Curiously it is not reproducible in IE 11.20.10586.0.

Xotic750 commented 8 years ago

Same here https://jsfiddle.net/Xotic750/ocmsxhjs/

ljharb commented 8 years ago

I'm not entirely sure what's causing this, since String#search isn't being shimmed directly - it probably calls into something else that is being shimmed (which is a native bug in and of itself).

ljharb commented 8 years ago

oops, nvm, this is a bug in RegExp.prototype[Symbol.search]. Fixing!