Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd imagine it has something to do with the fact that these two functions call each other, and as a far as I can tell, the <code>if</code> statements, once true, will always be true.</p> <pre><code>function removeForm(span) { if (previousSpan == null) return false; &lt; --Out of memory here according to IE if (previousSpan.parentNode.getElementsByTagName("form").length != 0) previousSpan.parentNode.removeChild(span.parentNode.getElementsByTagName("form")[0]); var result = (span == previousSpan); if (result) collapse(previousSpan); // &lt;--------------- previousSpan = null; // | return result; // | } // | // | function collapse(span) { // | if (previousSpan == span) removeForm(span); // &lt;-------- span.innerHTML = span.innerHTML.replace("▼", "►"); while (span.nextSibling != null) { span = span.nextSibling; if (span.className == "comment-content show"); span.className = "comment-content hide"; } } </code></pre> <p>Effectively:</p> <pre><code>var previousSpan; function removeForm( span ) { // ... if( span == previousSpan ) collapse(previousSpan); // ... } function collapse( span ) { // &lt;---here span is previousSpan, // &lt;-- always true because you're doing if(previousSpan == previousSpan) if (previousSpan == span) removeForm(span); // ... } // This makes subsequent comparisons in "removeForm()" always true as well, // because now it is guaranteed that "span" is the same as "previousSpan" </code></pre> <p>So once <code>span == previousSpan</code> in <code>removeForm()</code>, you're passing <code>previousSpan</code> to <code>collapse()</code>. The first thing <code>collapse()</code> does is checks to see if what it received is equal to <code>previousSpan</code>, which it always will be since that was the test to send it in the first place.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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