title: jQuery/AJAX - nested functions. Clone & Cufon
body: <p>I'm using Cufon, it's a very simple script changing fonts into canvas.</p>
  
  <p>This code changes H1 headers:</p>
  
  <pre><code> Cufon.replace('h1', { fontFamily: 'SuperMegaArial2010' }); 
  </code></pre>
  
  <p>Everything works fine, but I'm cloning a set of items (a few lists with headers in them):</p>
  
  <pre><code>jQuery('ul.myList').clone();
  </code></pre>
  
  <p>And the cufon font replacement doesn't work for the cloned items.</p>
  
  <p>How to change that? Why does it happen?</p>
  
  <p>[edit]</p>
  
  <p>Ok, it's going to be complicated. I'm cloning my list so it will work as a second list for <a href="http://razorjack.net/quicksand/" rel="nofollow">Quicksand</a>. And it works, but Cufon doesn't.</p>
  
  <pre><code>jQuery('document').ready(function(){    
      //create a clone of the full list of elements and extract 'li' elements
      //in order to use it as the 'second' list for quicksand
          var cache_list = jQuery('ul.myList').clone();
          //Add on click event handler to the 'Show Everything' button
  
          jQuery('ul.myList li a[data-value=Everything]').click(function(e) {
              //Call quicksand on the original works_list list(the one visible to the user)
              //pass to it all the 'li' elements from the cached clone 
                  //since we want to display them all
                  jQuery('.myList').quicksand( cache_list.find('li'), {
                          duration: 500,
                          });
  
          jQuery('ul.myList li a[data-value=funny]').click(function(e) {
                 jQuery('.myList').quicksand( cache_list.find('li[data-value=funny]'), {
                    duration: 500,
                  });
                  e.preventDefault();
          });    
  });
  </code></pre>
  
  <p>This code is being executed long time after Cufon, I've tried adding cufon replace js code once again in the same file before the code above, but didn't help.</p>