title: Appended jQuery script not working on Safari (Mac)
body: <p>I found a weird problem. </p>
  
  <p>I'm making first step to comet with my webapp. Long story short, I have a nice little script that polls another scripts which are sent by php controller.</p>
  
  <p>Later on, i would work on both ways. Either as longpolling or just like it works now - on javascript intervals.</p>
  
  <p>How it works on Chrome:
  On "ready" event first script sets an interval on function which sends an ajax request to controller (let's name it 'ping.php'). If ajax is made with success, msg should replace the html content of the div#wrapperForJs.</p>
  
  <p>Ping.php checks database for updates and if it meet one script result with the script echo.</p>
  
  <p>Text above was for humanists, now tl;dr:</p>
  
  <p>jQuery code:</p>
  
  <pre><code>function pingThatApp(){
  $.ajax({
          type: 'GET',
          url: '/ping', 
          success: function(msg){
              $('#pingWrapper').html(msg);
          }
      });
  }
  $(document).ready(function(){
  window['pingLoop'] = setInterval(
      function(){
          pingThatApp(); 
      },4000
     );     
  });
  </code></pre>
  
  <p>PHP echo:</p>
  
  <pre><code>$timeScrpt = '&lt;script&gt;';
      foreach ($timers['p'] as $k =&gt; $v) {
          $timeScrpt .= "$('#project-{$k} .pTime').fadeOut().attr('title', 'Time spent already: {$v}').html('{$v_short}').fadeIn();";
  
      }
      foreach ($timers['t'] as $k =&gt; $v){
          $timeScrpt .= "$('#timeSpent-task-{$k} b').fadeOut().html('{$v}').fadeIn();";
      }
      $timeScrpt .= '&lt;/script&gt;';
  </code></pre>
  
  <p>Everything works great on Chrome. However Safari has some problems with that script. The problem looks like Safari can't find the jQuery objects. </p>
  
  <p>I made some console.log test, checked the code - output looks good.</p>
  
  <p>If I change the $k var and hardcode it with some int or overwrite the $k var in beggining of the iteration, it works on Safari also (jQuery finds the element). </p>
  
  <p>I also make the console.log test with length of found elements:</p>
  
  <pre><code>el = $('#project-$k .pTime'); console.log(el.length);
  </code></pre>
  
  <p>Chrome outputs something like (0,0,0,1,1,1,0) [0 not found, 1 - found0
  Safari always outputs 0s.</p>
  
  <p>I writing here because have no idea what's going on with that precious browser. Maybe someone here has any solution.</p>
  
  <p>And please, don't try to convince me that intervals are no good for data update purpose. I know that, hovever for now it's the best what I can implement.</p>