andrewplummer / Sugar

A Javascript library for working with native objects.

Home Page:https://sugarjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

string replaceAll breaks normal js replaceAll

jsqldb opened this issue · comments

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.

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