Skip to content

Instantly share code, notes, and snippets.

@breezhang
Last active August 29, 2015 14:03
Show Gist options
  • Save breezhang/3d915de0080afc59705a to your computer and use it in GitHub Desktop.
Save breezhang/3d915de0080afc59705a to your computer and use it in GitHub Desktop.
The Complete Set
stylesheet.insertRule(rule, index)
https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet.insertRule
CSSStyleSheet.deleteRule()
document.styleSheets[0].insertRule('#elid:hover { background-color: red; }', 0);
document.styleSheets[0].cssRules[0].style.backgroundColor= 'red';
===
document.styleSheets[0].addRule('#elid:hover', 'background-color: red', 0);
document.styleSheets[0].rules[0].style.backgroundColor= 'red';
:first-child :first-of-type :only-child
:last-child :last-of-type :only-of-type
:nth-child :nth-of-type
:nth-last-child :nth-last-of-type
::first-letter ::first-line ::first-word
::last-letter ::last-line ::last-word
::nth-letter ::nth-line ::nth-word
::nth-last-letter ::nth-last-line ::nth-last-word
window.Sizzle = jQuery.find;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment