title: How to determin that javascript has finished doing something
body: <p>JS on ios is rather slow. For example in this piece of code, the Js adds the class before being able to add the block style. This breaks an animation i have on the page.</p>
  
  <pre><code>comments.style.display="block";comments.className = "show";
  </code></pre>
  
  <p>I have a workaround that fixes the issue on ios but just feels wrong:</p>
  
  <pre><code>comments.style.display="block";setTimeout(function(){comments.className = "show";},1)
  </code></pre>
  
  <p>Is there any way to determine if the block style has been set and only then trigger the second part?</p>
  
  <p>Thanks for your suggestions!</p>