Keep in mind that Safari is still in beta. Report the bug to Apple, and wait for the final release. The solution is theirs to find.
It's commendable that you are trying to make your script work with all browsers, but such a bug is just out of you control.
-- dakkar - Mobilis in mobile