Note that there are some explanatory texts on larger screens.

plurals
  1. POSome questions about the 25 jquery tips
    primarykey
    data
    text
    <p>I was just reading this: <a href="http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx" rel="nofollow noreferrer">http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx</a></p> <p>And had some questions about some of the advocated tricks:</p> <p><strong>9 - Give your selectors a context:</strong></p> <p>What's the difference between using a context and using a more specific selector?</p> <p>Rather than doing</p> <pre><code>var selectedItem = $('#listItem' + i, $('.myList')); </code></pre> <p>What about</p> <pre><code>var selectedItem = $('.myList&gt;#listItem' + i); </code></pre> <p>Which one is faster/better, or is there no difference?</p> <p><strong>12 - Learn about event delegation:</strong></p> <p>I would imagine that at low handler counts event delegation is slower than normal binding. </p> <p>How many handlers is the time when you should start using event delegation?</p> <p>Also, what is the difference (in terms of how fast or how 'good' it is) between using delegation and creating a click target in dom, having the user click that click target, and then have the click target find the elements to manipulate. Is this method faster or is delegation faster?</p> <p>Edit: In addition, how many levels should you be delegating? Is it better to delegate something 10 levels away, or to simply bind 2 handlers.</p> <p><strong>13 - Use classes to store state</strong></p> <p><strong>14 - Even better, use jQuery's internal data() method to store state:</strong></p> <p>Why use data vs classes? Is data faster? I think I generally find classes to be easier to read, contradicting what it says in the blog entry, because I can see it in the DOM.</p> <p>Thanks!</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.
 

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