diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2020-03-09 14:44:57 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2020-03-09 14:44:57 +0100 |
commit | d42d88dae49f7441f9751ebee301dea7ecef1d58 (patch) | |
tree | 686d264eb568c935b7967692da04a0fa7e0e2056 /js/utils | |
parent | ddd13ee9cfa8d42b5202f1ce34cd00b5029b3279 (diff) | |
download | fosdem-2021-minimalism-presentation-d42d88dae49f7441f9751ebee301dea7ecef1d58.tar fosdem-2021-minimalism-presentation-d42d88dae49f7441f9751ebee301dea7ecef1d58.tar.gz |
break autoanimate and loading of slide content into separate controllers
Diffstat (limited to 'js/utils')
-rw-r--r-- | js/utils/util.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/js/utils/util.js b/js/utils/util.js index a7aae7b..868f02b 100644 --- a/js/utils/util.js +++ b/js/utils/util.js @@ -140,16 +140,22 @@ export const enterFullscreen = () => { * * @param {string} value */ -export const injectStyleSheet = ( value ) => { +export const createStyleSheet = ( value ) => { let tag = document.createElement( 'style' ); tag.type = 'text/css'; - if( tag.styleSheet ) { - tag.styleSheet.cssText = value; - } - else { - tag.appendChild( document.createTextNode( value ) ); + + if( value && value.length > 0 ) { + if( tag.styleSheet ) { + tag.styleSheet.cssText = value; + } + else { + tag.appendChild( document.createTextNode( value ) ); + } } - document.getElementsByTagName( 'head' )[0].appendChild( tag ); + + document.head.appendChild( tag ); + + return tag; }
\ No newline at end of file |