Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
Created December 6, 2009 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarongustafson/250035 to your computer and use it in GitHub Desktop.
Save aarongustafson/250035 to your computer and use it in GitHub Desktop.
var
style = document.createElement('style'),
addRules = function( el, styles )
{
el.appendChild( document.createTextNode( styles ) );
};
if ( defined( style.styleSheet ) )
{
addRules = function( el, styles )
{
el.styleSheet.cssText += styles;
};
}
var
style = document.createElement('style'),
addRules = function( el, styles )
{
if ( defined( style.styleSheet ) )
{
el.styleSheet.cssText += styles;
}
else
{
el.appendChild( document.createTextNode( styles ) );
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment