Skip to content

Instantly share code, notes, and snippets.

@thornbill
Created September 11, 2014 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thornbill/ce4045fc1a0b34ad873b to your computer and use it in GitHub Desktop.
Save thornbill/ce4045fc1a0b34ad873b to your computer and use it in GitHub Desktop.
Remove a random rule from a random stylesheet
(function(document) {
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
var sheets = document.styleSheets,
sheet = sheets[getRandomInt(sheets.length-1)],
rules = sheet.cssRules,
rule = getRandomInt(rules.length-1);
// console.log(rules[rule]);
sheet.deleteRule(rule);
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment