Chrome getting stuck on this jquery code, FF is fine
<p>I have a page where I load several images from wikipedia. Wikipedia images have a filepath which you have to calculate from the filename, and which you then have to append to the following: <code>http://upload.wikimedia.org/wikipedia/commons/thumb/</code>.</p>

<p>There are two problems.</p>

<ol>
<li><p>In a minority of pictures, the url has <code>/en/</code> instead of <code>/commons/'</code>, but there's no way to know when. </p></li>
<li><p>Some of the links are outdated and don't return any image, leaving me with an ugly container div.</p></li>
</ol>

<p>So I first try to load the image with <code>commons</code> and wrote some code which checks if the image gives an error. If it does, it replaces the <code>commons</code> with <code>en</code>. Then, if the image STILL gives an error (meaning the picture doesn't exist at all) the code replaces the entire src with <code>''</code> and hides the div.</p>

<p>All this works great with FF, but it crashes in Chrome. I get endless <code>jquery.min.js:2    Uncaught RangeError: Maximum call stack size exceeded</code> errors. If anyone could tell me what the problem is with my code and help me fix it I'd really appreciate it!</p>

<p>Here's the code:</p>

<pre><code>$('#imgid').error(function()
{
   $(this).one("error", function() {
         $(this).attr('src','');$(this).parent().parent().parent().hide();
  }).attr('src', $(this).attr('src').replace("/commons/", "/en/"));

});
</code></pre>

<p>TIA!</p>

<p>EDIT: The html surrounding the image looks like this:</p>

<pre><code>&lt;div data-id="7551400" class="pin"&gt;
&lt;div id="sc7551400" class="scrol"&gt;
 &lt;a class="PinIm" target="_blank" name="http://upload.wikimedia.org/wikipedia/commons/c/c0/Cage_de_Faraday.jpg" href=""&gt;
   &lt;img class="PinImageImg" alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Cage_de_Faraday.jpg/155px-Cage_de_Faraday.jpg" style="width:155px" id="img-7551400"&gt;
    &lt;/a&gt;
       &lt;/div&gt;
       &lt;/div&gt;
</code></pre>
