Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Add includes polyfill for IE11 #18

Open
Yago opened this issue Aug 16, 2017 · 5 comments
Open

Add includes polyfill for IE11 #18

Yago opened this issue Aug 16, 2017 · 5 comments
Labels
Milestone

Comments

@Yago
Copy link
Member

Yago commented Aug 16, 2017

Add the following Polyfill for String.includes :

if ( !String.prototype.includes ) {
  String.prototype.includes = function(search, start) {
    'use strict';
    if (typeof start !== 'number') {
      start = 0;
    } 

    if (start + search.length > this.length) {
      return false;
    } else {
      return this.indexOf(search,start) !== -1;
    }
  };
}
@Yago Yago added the bug label Aug 16, 2017
@Yago Yago added this to the V1 milestone Aug 16, 2017
@Yago
Copy link
Member Author

Yago commented Nov 1, 2017

should be fixed with frontend/toolbox-utils@0ba0607

@gido
Copy link

gido commented May 15, 2018

For some reason this is not enough for IE 11 / Windows 8.1 (Browserstack):

screen shot 2018-05-15 at 18 30 02

The polyfill doen't look to be served by polyfill.io
/cc @zufrieden

@gido
Copy link

gido commented May 15, 2018

Or maybe we are calling includes on something other than a String...

@dmrty
Copy link

dmrty commented Jun 7, 2018

Correct @gido, Array.prototype.includes is needed as well.
Used at least at the following locations :

  • src/views/Doc/Doc.js
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=String.prototype.includes,Array.prototype.includes,Array.prototype.find"></script>

solves the problem.

@dmrty
Copy link

dmrty commented Jun 7, 2018

Also needs to update the doc accordingly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants