title: How can I force WebKit to redraw/repaint to propagate style changes?
body: <p>I have some trivial JavaScript to effect a style change:</p>
  
  <pre><code>sel = document.getElementById('my_id');
  sel.className = sel.className.replace(/item-[1-9]-selected/,'item-1-selected');
  return false;
  </code></pre>
  
  <p>This works fine with the latest versions of FF, Opera and IE, but fails on the latest versions of Chrome and Safari.</p>
  
  <p>It affects two descendants, which happen to be siblings. The first sibling updates, but the second doesn’t. A child of the second element also has focus and contains the <strong>&lt;a&gt;</strong> tag that contains the above code in an <strong>onclick</strong> attribute.</p>
  
  <p>In the Chrome “Developer Tools” window if I nudge (e.g. uncheck &amp; check) <em>any</em> attribute of <em>any</em> element, the second sibling updates to the correct style.</p>
  
  <p>Is there a workaround to easily and programmatically “nudge” WebKit into doing the right thing?</p>