Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript, yet another "too much recursion" issue: Revenge of evil eval()
    primarykey
    data
    text
    <p>I'm working on a project (a very old one who was revived) for a client.</p> <p>When I browse one of the JSPs of the project in Firefox (4.0 in this case, but I suppose it happens with 3.x also), the following error appears on Firebug console:</p> <blockquote> <p>Error: too much recursion<br> Archivo fuente: <a href="https://localhost:9443/ClientProjectWeb/js/Object.js" rel="nofollow">https://localhost:9443/ClientProjectWeb/js/Object.js</a><br> Línea: 226</p> </blockquote> <p>Here is the code snippet of that line:</p> <pre><code>if(gControl){giveFocusToControl(gControl.name);} </code></pre> <p>This is the invoked function:</p> <pre><code>function giveFocusToControl(nombreControl){ var forma = document.forms[0]; var campo = null; if(forma){ var elemento = eval("forma."+nombreControl); if(eval(elemento.length)){ if(elemento.type == "select-one" || elemento.type == "select-multiple"){ campo = elemento; }else{ campo = elemento[0]; } }else{ campo = elemento; } if(campo.style &amp;&amp; campo.style.visibility){ if(campo.style.visibility != "hidden"){ campo.focus(); } }else{ campo.focus(); } } } </code></pre> <p>I suspect this has to do with <code>eval()</code> calls inside a function, but despite I have tried to replace those "evil" calls with [] alternative proposed in <a href="http://dev.opera.com/articles/view/efficient-javascript/?page=2" rel="nofollow">this document</a>, for example: <code>var elemento = forma[nombreControl];</code>, I haven't got the expected result, the error still is there: same line, same message.</p> <p>Please do you have any suggestion? Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload