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

fix: make sure that document.createElement exists before using (#3706)

If you try and require videojs in an environment that doesn't implement `document.createElement` properly -- like in Node.js -- you could potentially get an error. This checks that `window.document && window.document.createElement` is available before calling `createElement`.
We specifically check `window.document` so that `global` module won't cause issues with it's shimming of `document.createElement` in `global/document.

Fixes #3665
This commit is contained in:
Gary Katsevman 2016-10-25 14:20:49 -04:00 committed by GitHub
parent ac0329f875
commit 49e29bac85

View File

@ -33,7 +33,9 @@ import xhr from 'xhr';
import Tech from './tech/tech.js';
// HTML5 Element Shim for IE8
if (typeof HTMLVideoElement === 'undefined') {
if (typeof HTMLVideoElement === 'undefined' &&
window.document &&
window.document.createElement) {
document.createElement('video');
document.createElement('audio');
document.createElement('track');