/**
 * @desc appendCss() appends css once jQuery + head element have finished loading
 *
 * @param {String} should be wrapped in style tags <style>+ 'css' + </style>
 */
import when from './when';

function appendCss(css){
  if (css.indexOf('<style>') !== 0 ) css = css.replace(/^/,'<style>');
  if (css.indexOf('</style>') === -1 ) css = css.replace(/$/,'</style>');
  when('body', function(){
    document.head.insertAdjacentHTML('beforeend', css)
  });  
}

export default appendCss;

var css = '<style>* {color: red}</style>'
@@ -106,64 +106,54 @@
 g%7D s
-hould be wrapped in style tags %3Cstyle%3E+ 'css' + %3C/style%3E
+tring of css rules, with or without style tags
 %0A */
@@ -438,18 +438,16 @@
 s)%0A  %7D);
-  
 %0A%7D%0A%0Aexpo
@@ -472,46 +472,4 @@
 ss;%0A
-%0Avar css = '%3Cstyle%3E* %7Bcolor: red%7D%3C/style%3E'

Update description