After some discussion on IRC, I think Jonas, Hixie and I agreed that we're OK with the following approach:<br>-- sound is produced for display:none elements and elements not in the DOM<br>-- removing an element from the DOM automatically calls stop() on that element
<br>-- tearing down the owner document always stops the element playing (so navigating away from the page always stops sound)<br clear="all"><br>Therefore<br>myAudio = new Audio("foo.wav");<br>myAudio.onload = function () {
<br> this.play();<br> myAudio = null;<br>}<br>will work, and will play until the sound ends or the user leaves the page.<br><br>Rob<br>-- <br>"Two men owed money to a certain moneylender. One owed him five hundred denarii, and the other fifty. Neither of them had the money to pay him back, so he canceled the debts of both. Now which of them will love him more?" Simon replied, "I suppose the one who had the bigger debt canceled." "You have judged correctly," Jesus said. [Luke 7:41-43]