This overwrites String.prototype.startsWith and breaks any code that expects a modern implementation to be present (like Office web add-ins or wherever this file gets loaded).
Issue
This implementation of String.prototype.startsWith doesn't support the position parameter, while all modern browsers do (it's also in here now: https://tc39.es/ecma262/#sec-string.prototype.startswith) - with the egregious bonus of not even checking whether a polyfill is even required.
Proposed solution
This polyfill should only be installed if String.prototype.startsWith does not exist.
The polyfill should implement a modern version with support for the position parameter (which would be functionally equivalent for code that uses it without anyway)
This overwrites
String.prototype.startsWith
and breaks any code that expects a modern implementation to be present (like Office web add-ins or wherever this file gets loaded).Issue
This implementation of
String.prototype.startsWith
doesn't support theposition
parameter, while all modern browsers do (it's also in here now: https://tc39.es/ecma262/#sec-string.prototype.startswith) - with the egregious bonus of not even checking whether a polyfill is even required.Proposed solution
String.prototype.startsWith
does not exist.position
parameter (which would be functionally equivalent for code that uses it without anyway)https://github.com/microsoft/referencesource/blob/51cf7850defa8a17d815b4700b67116e3fa283c2/System.Web.Extensions/Script/String.js#L19
NB: I'm referring to this version of the file in the wild, please let me know if this is the wrong source repo https://ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js