aurelia/polyfills

Rejection error: String polyfills not working in IE 11

ckotzbauer opened this issue · 6 comments

Hi,

I've a problem with the "endsWith" and "startsWith" polyfills in IE 11. I get the following errors in the console for "endsWith"

Unhandled rejection Error: function (searchString, position) {
        var subjectString = this.toString();
        console.log("polyfills: [" + subjectString + "|" + searchString + "|" + position + "]");
        if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
          position = subjectString.length;
        }
        position -= searchString.length;
        var lastIndex = subjectString.indexOf(searchString, position);
        return lastIndex !== -1 && lastIndex === position;
      }
   at getViewStrategy (http://localhost/Customer/assets/bundle.js:13801:10)
   at load (http://localhost/Customer/assets/bundle.js:16978:8)
   at load (http://localhost/Customer/assets/bundle.js:16051:6)
   at load (http://localhost/Customer/assets/bundle.js:15993:8)
   at Anonymous function (http://localhost/Customer/assets/bundle.js:16361:10)
From previous event:
   at importViewResources (http://localhost/Customer/assets/bundle.js:16330:6)
   at Anonymous function (ht

and for "startsWith":

Unhandled rejection Error: function (searchString, position) {
        position = position || 0;
        return this.substr(position, searchString.length) === searchString;
      }
   at getViewStrategy (http://localhost/Customer/assets/bundle.js:13801:10)
   at load (http://localhost/Customer/assets/bundle.js:16978:8)
   at load (http://localhost/Customer/assets/bundle.js:16051:6)
   at load (http://localhost/Customer/assets/bundle.js:15993:8)
   at Anonymous function (http://localhost/Customer/assets/bundle.js:16361:10)
From previous event:
   at importViewResources (http://localhost/Customer/assets/bundle.js:16330:6)
   at Anonymous function (http://localhost/Customer/assets/bundle.js:436:6)
From previous event:
   at loadResources (http://localhost/Customer/assets/bundle.js:425:4)
   at Anonymous function (http://localhost/Customer/assets/bundle.js:504:8)
   at next (http://localhost/Customer/assets/bundle.js:384:8)
   at runTasks (http://localhost/Customer/assets/bundle.js:390:4)
   at Anonymous function (http://

I replaced this functions with this polyfills https://github.com/mathiasbynens/String.prototype.startsWith and https://github.com/mathiasbynens/String.prototype.endsWith and it worked.

My app is running with the newest aurelia versions and Webpack as bundler.

Has anybody an idea for this behavior?
Thanks!

@code-chris Are you still having this issue?

Sorry for the long delay. I will try to reproduce this in a view days.

Can't reproduce this. Seems to work now.

Whaa! https://imgs.xkcd.com/comics/wisdom_of_the_ancients.png

What did you to do make it go away?

How did you get it in the first place? Maybe some incorrect combination of polyfills, i.e babel polyfills + aurelia polyfills?

@Expaso I only used aurelia-polyfills and bluebird as "classic" polyfill libs. There was always an error in the aurelia-polyfills.js file before the two string functions were applied. But I don't know exactly, it's two years in the past now. 😆