Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's testing <code>$target</code> (which I assume is a jQuery object) for elements and if empty, assigning a default value.</p> <p>See <a href="https://developer.mozilla.org/en/JavaScript/Reference/Operators/Logical_Operators" rel="nofollow">Logical Operators</a> for a detailed explanation.</p> <h2>Update</h2> <p>To explain (in case you don't feel like reading the MDN docs), JavaScript logical comparison operators work left-to-right.</p> <pre><code>expr1 &amp;&amp; expr2 </code></pre> <p>This will return <code>expr1</code> if it can be converted to <code>false</code>; otherwise, returns <code>expr2</code></p> <pre><code>expr1 || expr2 </code></pre> <p>This will return <code>expr1</code> if it can be converted to <code>true</code>; otherwise, returns <code>expr2</code></p> <p>To break down the line in question, think of it this way</p> <pre><code>$target = ($target.length &amp;&amp; $target) || $('[name=' + this.hash.slice(1) +']'); </code></pre> <p>Looking at the first operation...</p> <pre><code>$target.length &amp;&amp; $target </code></pre> <p>This will return <code>$target.length</code> if <code>$target.length</code> can be converted to <code>false</code> (ie <code>0</code>), otherwise it will return <code>$target</code>.</p> <p>The second operation looks like this...</p> <pre><code>(operation1) || $('[name=' + this.hash.slice(1) +']') </code></pre> <p>If the result of the <code>operation1</code> can be converted to <code>true</code> (ie <code>$target</code>), then it will be returned, otherwise <code>$('[name=' + this.hash.slice(1) +']')</code>.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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