<NME> load-css.js
<BEF> var Promise = require('promise');
var chrome = require("chrome-framework");
function loadCSS(opts, doneCallback) {
  var url = chrome.extension.getURL(opts.path);

	var link = document.createElement("link");
	var sheets = document.styleSheets;
  link.rel = "stylesheet";
  link.href = url;

  link.href = url;
  if (opts.id) link.id = opts.id;

  document.head.appendChild(link);

  var checkElement = document.createElement("div");
  checkElement.setAttribute("class", opts.checkClass);
  document.body.appendChild(checkElement);

  var scheduleId = null;
  var attempts = 0;

  return new Promise(function(resolve, reject) {
    function scheduleCheck() {
      var content = window.
        getComputedStyle(checkElement, ":before").
        getPropertyValue("content");

      if (attempts > MAX_WAIT) {
        return reject(
          Error("fail to load css: '" + url + "', content loaded: " + content)
        );
      }

      if (/loaded/.test(content)) {
        cancelAnimationFrame(scheduleId);
        document.body.removeChild(checkElement);
        resolve();

      } else {
        attempts++;
        scheduleId = requestAnimationFrame(scheduleCheck, 1);
      }
    }

    scheduleCheck();
  });
}

module.exports = loadCSS;

<MSG> small fixes

<DFF> @@ -3,8 +3,8 @@ var chrome = require("chrome-framework");
 function loadCSS(opts, doneCallback) {
   var url = chrome.extension.getURL(opts.path);
 
-	var link = document.createElement("link");
-	var sheets = document.styleSheets;
+  var link = document.createElement("link");
+  var sheets = document.styleSheets;
   link.rel = "stylesheet";
   link.href = url;
 

{'addition_count': 2, 'commit_subject': 'small fixes', 'deletion_count': 2, 'file_extension': '.js', 'lang': 'js', 'license': 'mit', 'repo_name': 'tulios/json-viewer'}