1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-17 21:18:27 +02:00

fix(time-display): add a null check for text node (#6977)

fixes #6699
closes #6700
This commit is contained in:
kontrollanten 2020-12-11 22:01:36 +01:00 committed by GitHub
parent 0631f037eb
commit 3e30f83bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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_);