This may seem silly question but I seek clarification since my application is very huge.
var audio = document.createElement("audio");
Do I have to always append this element to a parent node like:
document.body.appendChild(audio); // or something
Is it necessary since I remove and create the audio element on the fly base on a handler function or user interaction?
My current practice is that I never append them to anything. Is this a good practice?
Note: I do this because there is no current browser supports switching audio API source node natively. It can be done through hack.
Not entirely correct. You can also insert it. But yes, it needs to go into the DOM somewhere.
Thank you Mittineague. I do some research base on your suggestion. The bellow link to a (rather old) article suggests that the insert method you recommended is better a practice than appenChild.
You've really made my day.
This topic is now closed. New replies are no longer allowed.