Ahhh... includes(), or rather, its early Firefox equivalent, .contains(), is currently the bane of my existence at work. We have an application that has been locked to Firefox 39 for several years due to certain plugins we utilize never being updated and we've just finally started the upgrade to the latest version of FF, which, of course, supports the new .includes() spec and dropped .contains() entirely (39 was the last to support it, funny enough). One of our other devs utilized .contains() pretty liberally and things are breaking everywhere as a result. Until we get everything sorted, everyone is staying on 39, which means we can't simply replace .contains() with .includes() as it will work in one browser version, but not the other. Our solution so far has been to just replace everything with .indexOf(). Wish we could use .includes() as its syntax is more meaningful and it's slightly more robust.
Unfortunately, it'd be just as tedious of a task. It's a vendor system we're working with and we extend it by creating small JS plugins. You have to create a "script list" for every plugin you create, as they're self-contained little windows that the system runs in their own iframes. We'd have to go through the code base and find every instance of the .contains() usage and then find the script list associated with all of them and include the polyfill. It's not something we can just add to every instance the software creates, unfortunately, otherwise it'd be a super simple task :(
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ahhh... includes(), or rather, its early Firefox equivalent, .contains(), is currently the bane of my existence at work. We have an application that has been locked to Firefox 39 for several years due to certain plugins we utilize never being updated and we've just finally started the upgrade to the latest version of FF, which, of course, supports the new .includes() spec and dropped .contains() entirely (39 was the last to support it, funny enough). One of our other devs utilized .contains() pretty liberally and things are breaking everywhere as a result. Until we get everything sorted, everyone is staying on 39, which means we can't simply replace .contains() with .includes() as it will work in one browser version, but not the other. Our solution so far has been to just replace everything with .indexOf(). Wish we could use .includes() as its syntax is more meaningful and it's slightly more robust.
Why don't you polyfill
.contains
and switch to the latest version?I'm pretty sure you've already considered this, but it seems a reasonable alternative to doing a search and replace to the entire codebase.
Unfortunately, it'd be just as tedious of a task. It's a vendor system we're working with and we extend it by creating small JS plugins. You have to create a "script list" for every plugin you create, as they're self-contained little windows that the system runs in their own iframes. We'd have to go through the code base and find every instance of the .contains() usage and then find the script list associated with all of them and include the polyfill. It's not something we can just add to every instance the software creates, unfortunately, otherwise it'd be a super simple task :(