Skip to content

Instantly share code, notes, and snippets.

@remy
Forked from necolas/stylesheet-injector.js
Created November 5, 2010 13:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save remy/664147 to your computer and use it in GitHub Desktop.
Save remy/664147 to your computer and use it in GitHub Desktop.
(function() {
var css = [
'/css/default.css',
'/css/section.css',
'/css/custom.css'
],
i = 0,
link = document.createElement('link');
link.rel = 'stylesheet',
head = document.getElementsByTagName('head')[0],
tmp;
for(; i < css.length; i++){
tmp = link.cloneNode();
tmp.href = css[i];
head.appendChild(link);
}
})();
@gf3
Copy link

gf3 commented Nov 5, 2010

Notice the semi-colon at the end of L8, oops! Comma-first FTW! Also you're appending link instead of tmp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment