Issue #864💬 AnsweredOpened February 13, 2018by panagulis720 reactions

Symbol.iterator in Internet Explorer doesn't work

快速解答by ryandeba

Hi @panagulis72, Have you looked into using a polyfill? A quick google search found this...I've never used Symbol.iterator before, so that's probably as much as I'd be able to help :(

Read full answer below ↓

Question

When I add an Image, in this block:

  for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
    var file = _step.value;

    _loop(file);
  }`

I get the error:

the object does not support the property or the 'jscomp_symbol_iterator0' method

It happens on IE 11. Is there an alternative to write that loop in another way, supported by IE?

Answers (3)

ryandebaFebruary 14, 2018

Hi @panagulis72,

Have you looked into using a polyfill? A quick google search found this...I've never used Symbol.iterator before, so that's probably as much as I'd be able to help :(

artfFebruary 18, 2018

Hi @panagulis72, unfortunately, that piece of code is generated by the compiler from this method (is it intentional your use of embedAsBase64?) if you want to find a way to write it up without generating it I'd be glad to merge your PR

panagulis72February 18, 2018

Hi @artf ! I'm talking about this file: https://raw.githubusercontent.com/artf/grapesjs/dev/dist/grapes.js

代码片段TEXT
try to search the string:

` for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)`

I'm talking about this loop

But I solved this issue replacing with this code:

`    try {
      for(var i = 0; i < files.length; i++){
        var file = files[i];
        _loop(file);
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }`


I don't know if it is a good solution, but in Internet Explorer works fine

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.