1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-29 22:07:10 +02:00

@gkatsev fixed potential double default style elements. closes

This commit is contained in:
Gary Katsevman 2015-09-21 17:52:32 -04:00 committed by heff
parent 651a33a145
commit 81000369ec
2 changed files with 12 additions and 8 deletions

@ -136,6 +136,7 @@ CHANGELOG
* @heff removed the loadedalldata event ([view](https://github.com/videojs/video.js/pull/2591))
* @dmlap switched to using raynos/xhr for requests ([view](https://github.com/videojs/video.js/pull/2594))
* @heff Fixed double loadstart and ready events ([view](https://github.com/videojs/video.js/pull/2605))
* @gkatsev fixed potential double default style elements ([view](https://github.com/videojs/video.js/pull/2619))
--------------------

@ -97,14 +97,17 @@ var videojs = function(id, options, ready){
};
// Add default styles
let style = stylesheet.createStyleElement('vjs-styles-defaults');
let head = document.querySelector('head');
head.insertBefore(style, head.firstChild);
stylesheet.setTextContent(style, `
.video-js {
width: 300px;
height: 150px;
`);
let style = document.querySelector('.vjs-styles-defaults');
if (!style) {
style = stylesheet.createStyleElement('vjs-styles-defaults');
let head = document.querySelector('head');
head.insertBefore(style, head.firstChild);
stylesheet.setTextContent(style, `
.video-js {
width: 300px;
height: 150px;
`);
}
// Run Auto-load players
// You have to wait at least once in case this script is loaded after your video in the DOM (weird behavior only with minified version)