1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-02 09:11:54 +02:00

Fix bug in loop for removing source/track nodes from video element.

"j.length" changed in each loop step, causing source/track nodes being left in DOM.
This commit is contained in:
sirudog 2012-03-18 22:25:19 +01:00
parent 2fe90f9c5c
commit 5c2a3cbbf8

View File

@ -58,9 +58,10 @@ _V_.Player = _V_.Component.extend({
// Empty video tag sources and tracks so the built in player doesn't use them also.
if (tag.hasChildNodes()) {
for (var i=0,j=tag.childNodes;i<j.length;i++) {
if (j[i].nodeName == "SOURCE" || j[i].nodeName == "TRACK") {
tag.removeChild(j[i]);
var nrOfChildNodes = tag.childNodes.length;
for (var i=0,j=tag.childNodes;i<nrOfChildNodes;i++) {
if (j[0].nodeName == "SOURCE" || j[0].nodeName == "TRACK") {
tag.removeChild(j[0]);
}
}
}