Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

Map.delete called while iterating #1

Open
Yaffle opened this issue Aug 14, 2013 · 2 comments
Open

Map.delete called while iterating #1

Yaffle opened this issue Aug 14, 2013 · 2 comments

Comments

@Yaffle
Copy link

Yaffle commented Aug 14, 2013

test case (IE11, FF25 - OK):

(function () {
  var s = [];
  var value = 42;
  var map = new Map();
  map.set(0, value);
  map.set(1, value);
  map.set(2, value);
  map.set(3, value);
  map.delete(1);
  map.forEach(function (value, key) {
    s.push(key);
    if (key === 0) {
      map.delete(0);
      map.delete(2);
      map.set(4);
    }
  });
  alert(s.join(""));//should alert 034
}(self));
@EliSnow
Copy link
Owner

EliSnow commented Aug 19, 2013

Thanks for the test case. As for the title of your issue it seems Blitz-Collections is having a problem with set not with delete.

For example:

(function () {
  var s = [];
  var value = 42;
  var map = new blitz.Map();
  map.set(0, value);
  map.set(1, value);
  map.set(2, value);
  map.set(3, value);
  map.forEach(function (value, key) {
    s.push(key);
    if (key === 0) {
      map.set(4);
    }
  });
  alert(s.join(""));//should alert 01234
}(self));

@jackrabbitj
Copy link

Set 1

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

No branches or pull requests

3 participants