Skip to content

Instantly share code, notes, and snippets.

@danshearmur
Created October 31, 2011 16:05
Show Gist options
  • Save danshearmur/1327839 to your computer and use it in GitHub Desktop.
Save danshearmur/1327839 to your computer and use it in GitHub Desktop.
Nice building a style tag
//https://github.com/addyosmani/github-watchers-button/blob/master/github-watchers.js
applyCss: function (css) {
var style = document.createElement('style');
style.type = 'text/css';
try {
style.appendChild(document.createTextNode(css));
} catch (e) {
if (style.styleSheet) {
style.styleSheet.cssText = css;
}
}
document.body.appendChild(style);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment