Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE11: Object doesn't support property or method 'forEach' #1058

Closed
panthony opened this issue Jan 24, 2019 · 7 comments
Closed

IE11: Object doesn't support property or method 'forEach' #1058

panthony opened this issue Jan 24, 2019 · 7 comments

Comments

@panthony
Copy link
Contributor

I have this issue on IE 11 in paper-dialog-inner because of the following line:

    let imageElements = this.element.querySelectorAll('img');
    // ...
    imageElements.forEach((image) => {
      image.addEventListener('load', this._checkContentOverflowOnLoad);
    });

As IE11 does not support .forEach on querySelectorAll result (see here).

The fix could be either to transform imageElements as an array [...document.querySelectorAll()] or add a small polyfill to add forEach on NodeList as suggested on developer.mozilla.org

@m3l1x
Copy link

m3l1x commented Feb 8, 2019

+1 running into exactly the same issue on Firefox older than 50

@panthony
Copy link
Contributor Author

panthony commented Feb 8, 2019

@m3l1x I added the suggered polyfill to fix the issue:

// missing forEach on NodeList for IE11
if (window.NodeList && !NodeList.prototype.forEach) {
  NodeList.prototype.forEach = Array.prototype.forEach;
}

@miguelcobain
Copy link
Collaborator

miguelcobain commented Feb 15, 2019

@panthony @m3l1x I created ember-cli-polyfill-importer and used it to import our polyfills, including nodelist foreach that this issue is about.

Could you please test your apps with ember-paper master to confirm that the polyfill is being added?

Please make sure that IE or FF < 50 (or any other version that doesn't have nodelist forEach) are included in your config/targets.js file.

@panthony
Copy link
Contributor Author

@miguelcobain (Un)fortunately I'm not equipped to test something on IE11.

What about this issue? Shall I close it?

I'm afraid others might be surprised by this issue too because it means that OOTB ember-paper is not compatible with IE11, unless you add this polyfill addon.

@m3l1x
Copy link

m3l1x commented Feb 15, 2019

@miguelcobain @panthony I gonna test it on monday and report.

@miguelcobain
Copy link
Collaborator

It is working for me on IE11!

Please reopen if issue persists.

@kumaresan-subramani
Copy link

@m3l1x I added the suggered polyfill to fix the issue:

// missing forEach on NodeList for IE11
if (window.NodeList && !NodeList.prototype.forEach) {
  NodeList.prototype.forEach = Array.prototype.forEach;
}

@m3l1x , can you share polyfills link?

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

No branches or pull requests

4 participants