Function throwing stack overflow in IE9

I have the following code snippet that pulls the image url from a PHP script via ajax based on the parameter that I pass to this function. The result is the disappearance of an existing image (jQuery), the src attribute gets a new image, and the image disappears. This works like a charm in Chrome, Firefox, etc., however IE9 throws "SCRIPT28: from the stack space" 'error !. If I switch IE9 to IE8 or IE7 mode, it works fine even if the error still appears. But in IE9, it cannot take off. Where am I going wrong?

function imager(dt){ $('.ct_img').fadeOut(400); var urip = homeURL + '/qwm/CF_QRGR/' + encodeURIComponent(dt) + '/'; $.ajax({url:urip, success:function(result){ $.doTimeout(400,function(){ if(result=='0'){ $('.ct_img').attr('src',homeURL + '/public/img/site/load_fail_message.jpg').bind('load', function (e) { $('.ct_img').fadeIn(400) }); } else { $('.ct_img').attr('src',homeURL + '/public/img/bank/vault/' + result).bind('load', function (e) { $('.ct_img').fadeIn(400) }); } }); } }); } 
+4
source share
2 answers

I suspect this is an event binding. Does event binding work without jQuery? Could there be many .ct_img classes? Because it will replace all their src and possibly overload it? So here using id

  var img = document.getElementById( "ct_img"); img.src = url; img.onload = function() { $('#ct_img').fadeIn(400); }; 

I don't know if IE has full stack stacks, but to make sure you have recursion you can configure the log console

  arguments.callee.caller.name.toString() 

to find out which method calls it.

+1
source

even IE10 doesn't have a complete (no) stacktrace at all, it's hard to debug ... This error can be caused by several other things: / In my case, I try to parse the form in one JS object and still get this error SCRIPT28: from the stack space, even if no events are bound to inputs and do not trigger any event.

But I noticed that when the browser mode is: IE9 document mode: IE7 --- I will get this error (i.e. on dell.com) --- when I manually switch to Document mode: IE9 , this error disappears ...

EDIT:

successfully solved my problem:

I used: console.log (JSON.stringify (object));

the object contained thousands of parameters from selectbox ... so even too much console.logging can call SCRIPT28: from the stack space (especially when used with JSON.stringify)

+1
source

Source: https://habr.com/ru/post/1438491/


All Articles