Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 210725

Plugin in advanced mode breaks in IE (all versions)

$
0
0

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.


Viewing all articles
Browse latest Browse all 210725

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>