Browser Bugs & Inconsistencies

Inconsistent implementation of the for ... in loop.

I ran into a hard-to-find bug today. After a while I figured out that IE cleared one of my hashes, for seemingly no good reason. This was my code:

  1. for (var p in hash) {
  2. hash["x_" + p] = hash[p];
  3. delete hash[p];
  4. }

I actually didn’t manage to reproduce this behavior outside of my original script, instead IE would go into an infinite loop and rapidly claim all available memory when the code ran.

Syndicate content