diff --git a/src/js/control-bar/time-controls/time-display.js b/src/js/control-bar/time-controls/time-display.js index fb403c97e..c38a5a9c0 100644 --- a/src/js/control-bar/time-controls/time-display.js +++ b/src/js/control-bar/time-controls/time-display.js @@ -5,6 +5,7 @@ import document from 'global/document'; import Component from '../../component.js'; import * as Dom from '../../utils/dom.js'; import formatTime from '../../utils/format-time.js'; +import log from '../../utils/log.js'; /** * Displays time information about the video @@ -86,7 +87,13 @@ class TimeDisplay extends Component { return; } - const oldNode = this.textNode_; + let oldNode = this.textNode_; + + if (oldNode && !this.contentEl_.contains(oldNode)) { + oldNode = null; + + log.warn('TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.'); + } this.textNode_ = document.createTextNode(this.formattedTime_);