diff --git a/lib/vtt.js b/lib/vtt.js index 66ab23f..d664c99 100644 --- a/lib/vtt.js +++ b/lib/vtt.js @@ -925,7 +925,11 @@ // video, depending on the writing direction, and reverse our axis directions. if (linePos < 0) { position += cue.vertical === "" ? containerBox.height : containerBox.width; - axis = axis.reverse(); + + // Safari 12 introduced a bug where the reverse order of an array is cached after calling + // array.prototype.reverse (https://bugs.webkit.org/show_bug.cgi?id=188794). + // As a workaround, call reverse on a copy of the 'axis' array, instead of calling it directly on the original var + axis = axis.slice().reverse(); } // Move the box to the specified position. This may not be its best