Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using document here instead of window.document? We're already importing it on line 8.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in the description, we can't use document because global/document tries to shim the DOM API in node.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me, then. Chalk it up to lack of sleep. 😆

document.createElement('video');
document.createElement('audio');
document.createElement('track');
Expand Down