Side navigation
    Ticket #7165: temp.html
  
  
  
    File temp.html, 0.8 KB (added by IgorMinar, October 12, 2010 05:38PM UTC)
    
      test case showing the leak
    
  
  
    
      
      <!doctype html>
<html xmlns:ng="http://angularjs.org">
  <head>
    <title></title>
    <script type="text/javascript"
         src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript">
      function cacheLength() {
        var l=0;
        for (var i in $.cache) { l++ };
        return l;
      }
      $(function() {
          var length =  {
            before: cacheLength()
          }
          $(document.body).html('<span>hello</span>');
          $('span').wrap('<div>');
          length.inBetween = cacheLength();
          $(document.body).html('');
          length.after = cacheLength();
          console.log(length);
          console.log('cached clean up properly: ', length.before == length.after);
        }); 
    </script>
  </head>
  <body>
  </body>
</html>
    
  
  
    Download in other formats:
    Original Format
  
File temp.html, 0.8 KB (added by IgorMinar, October 12, 2010 05:38PM UTC)
test case showing the leak
<!doctype html>
<html xmlns:ng="http://angularjs.org">
  <head>
    <title></title>
    <script type="text/javascript"
         src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript">
      function cacheLength() {
        var l=0;
        for (var i in $.cache) { l++ };
        return l;
      }
      $(function() {
          var length =  {
            before: cacheLength()
          }
          $(document.body).html('<span>hello</span>');
          $('span').wrap('<div>');
          length.inBetween = cacheLength();
          $(document.body).html('');
          length.after = cacheLength();
          console.log(length);
          console.log('cached clean up properly: ', length.before == length.after);
        }); 
    </script>
  </head>
  <body>
  </body>
</html>