ketting00 — 2013-09-01T02:18:06-04:00 — #1
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.
force — 2013-09-01T14:08:37-04:00 — #2
ketting00 — 2013-09-01T20:59:38-04:00 — #3
mittineague — 2013-09-01T21:25:33-04:00 — #4
Not entirely correct. You can also insert it. But yes, it needs to go into the DOM somewhere.
ketting00 — 2013-09-01T22:32:36-04:00 — #5
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.