Replies: 0
A recent plugin update broke the plugin in IE (and by extension broke the whole site it was on due to IE’s terrible error handling). The error returned was: Object doesn’t support property or method ‘endsWith’ . This is due to IE lacking support for the endsWith string function (used in the plugin on line 12 of svgs-inline.js).
The workaround I used was to add the following code from MDN to our theme js:
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchString, position) {
var subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.lastIndexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
I propose the plugin author either removes the reference to endsWith or just adds the code snippet to the actual plugin.