src/artoo.helpers.js
function getStylesheet(data, isUrl, cb) {
    var el = document.createElement(isUrl ? 'link' : 'style'),
        head = document.getElementsByTagName('head')[0];

    el.type = 'text/css';

    if (isUrl) {
      el.href = data;
      el.rel = 'stylesheet';

      // Waiting for script to load
      el.onload = el.onreadystatechange = function() {
        if ((!this.readyState ||
              this.readyState == 'loaded' ||
              this.readyState == 'complete')) {
          el.onload = el.onreadystatechange = null;

          if (typeof cb === 'function')
            cb();
        }
      };
    }
    else {
      el.innerHTML = data;
    }

    // Appending the stylesheet to head
    head.appendChild(el);
  }
function getStylesheet(data, isUrl, cb) {
    var el = document.createElement(isUrl ? 'link' : 'style'),
        head = document.getElementsByTagName('head')[0];

    el.type = 'text/css';

    if (isUrl) {
      el.href = data;
      el.rel = 'stylesheet';

      // Waiting for script to load
      el.onload = el.onreadystatechange = function() {
        if ((!this.readyState ||
              this.readyState == 'loaded' ||
              this.readyState == 'complete')) {
          el.onload = el.onreadystatechange = null;

          if (typeof cb === 'function')
            cb();
        }
      };
    }
    else {
      el.innerHTML = data;
    }

    // Appending the stylesheet to head
    head.appendChild(el);
  }
function getStylesheet ( data , isUrl , cb ) { var el = document . createElement ( isUrl ? 'link' : 'style' ) , head = document . getElementsByTagName ( 'head' ) [ 0 ] ; el . type = 'text/css' ; if ( isUrl ) { el . href = data ; el . rel = 'stylesheet' ; // Waiting for script to load el . onload = el . onreadystatechange = function ( ) { if ( ( ! this . readyState || this . readyState == 'loaded' || this . readyState == 'complete' ) ) { el . onload = el . onreadystatechange = null ; if ( typeof cb === 'function' ) cb ( ) ; } } ; } else { el . innerHTML = data ; } // Appending the stylesheet to head head . appendChild ( el ) ; }
Loading an external stylesheet
Loading an external stylesheet