Skip to content

Commit

Permalink
Fix issue of triggering removetrack event regardless if track was…
Browse files Browse the repository at this point in the history
… found. Formatting.
  • Loading branch information
Carey Hinoki committed Dec 7, 2015
1 parent 3123de0 commit 86b97cf
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/js/tracks/text-track-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,22 @@ TextTrackList.prototype.addTrack_ = function(track) {
};

TextTrackList.prototype.removeTrack_ = function(rtrack) {
let result = null;
let track;

for (let i = 0, l = this.length; i < l; i++) {
track = this[i];
if (track === rtrack) {
this.tracks_.splice(i, 1);
break;
if (this[i] !== rtrack) {
continue;
}

track = this[i];

this.tracks_.splice(i, 1);

break;
}

if (track) {
return;
}

this.trigger({
Expand Down

0 comments on commit 86b97cf

Please sign in to comment.