UNPKG

387 BJavaScriptView Raw
1/*
2 * create a style tag and append to head tag
3 * @params {String} css style
4 */
5
6function insertStyle ( css ) {
7 if(!css) return ;
8
9 if(typeof(window) == 'undefined') return ;
10 let style = document.createElement('style');
11 style.setAttribute('media', 'screen');
12
13 style.innerHTML = css;
14 document.head.appendChild(style);
15 return css;
16}
17
18export {
19 insertStyle
20}
\No newline at end of file