Skip to content

Commit

Permalink
feat: add warning if the element given to Video.js is not in the DOM (#…
Browse files Browse the repository at this point in the history
…4698)

Addresses #4697.
  • Loading branch information
odisei369 authored and gkatsev committed Nov 1, 2017
1 parent ad1b47b commit 6f713ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ function videojs(id, options, ready) {
throw new TypeError('The element or ID supplied is not valid. (videojs)');
}

// Check if element is included in the DOM
if (Dom.isEl(tag) && !document.body.contains(tag)) {
log.warn('The element supplied is not included in the DOM');
}

// Element may have a player attr referring to an already created player instance.
// If so return that otherwise set up a new player below
if (tag.player || Player.players[tag.playerId]) {
Expand Down

0 comments on commit 6f713ca

Please sign in to comment.