title: Return not in function
body: <p>Firebug is reporting a "return not in function" error with no location (well, line 1 of nothing).  How can I track down the source of this error?</p>
  
  <pre><code>return not in function
  [Break on this error] return(0)
  javascript:return... (line 1)
  </code></pre>
  
  <p>I'm running FireBug  1.05 on FF 2.0.0.20 on Ubuntu.</p>
  
  <p>I found a <b>solution</b> that works (for this configuration):</p>
  
  <pre><code>  var link = document.createElement('a');
    link.href='/';
    if (childSummary.more) {
      link.onclick = capture(function(id) { follow(id); }, childSummary.id);
    } else {
      link.onclick = capture(function(id) { show(id); }, childSummary.id);
    }
    link.appendChild(document.createTextNode(name));
    div.appendChild(link);
  
    [...]
  
   function capture(fn, val) {
     return function() { fn(val); return false; };
   }
  </code></pre>
  
  <p>The code was in a loop in which the id was changing, necessitating the capture function.</p>
  
  <p>Formerly the href was 'javascript: return 0' and the capture function wasn't returning false directly, instead using the result of the fn, and there was a path when it was returning the equivalent of true.  The href was being evaluated causing the error.</p>
  
  <p>Defining href as '#' or '' caused all the links to appear as already visited.  Not defining href at all caused there to be no link highlighting.  This seemed simplest.</p>