andrewplummer / Sugar

A Javascript library for working with native objects.
https://sugarjs.com/
MIT License
4.54k stars 305 forks source link

string replaceAll breaks normal js replaceAll #685

Closed jsqldb closed 2 years ago

jsqldb commented 2 years ago

To reproduce: Normal behaviour, when sugar is not included 'apple_apple'.replaceAll('apple','orange') results in: 'orange_orange' (This can be tested by opening chome dev tools on any web page)

If you include sugar, you will get this 'apple_apple'.replaceAll('apple','orange') results in: 'orange_' (This can be tested by opening chome dev tools on any https://sugarjs.com/, where sugar is included)

This is vary bad, because it will break all other code that uses replaceAll, including from included libs and your own js code.

jsqldb commented 2 years ago

Actually you can just not use Extended Mode then you won't have this problem. So all good.