I discovered this bug while dealing with another issue. The order of JavaScript commands listed is different than the order of their execution in Safari:
Example:
alert('here');
document.write('This is the hidden message.');
alert('You should be seeing the hidden message by now.');
In my browser the alerts are executed before the document.write() statement. I’ve seen this bug on two different Mac OS X’s using Safari versions 5.17, 6.0 and 6.0.2, but I haven’t confirmed that anyone else has seen this yet.
Here’s the fiddle:
Can anyone confirm that they see this and if so, tell me why this is happening?
I don’t think that’s a bug, strictly speaking. It’s just that it’s all synchronous, and there was no repaint before the second alert. Repaints don’t usually happen within the same “tick” of the browser’s event loop (although
document.writeseems to force a repaint in other browsers, e.g. Chrome).This (ugly) workaround should fix it: