Skip to content

Instantly share code, notes, and snippets.

View bofrede's full-sized avatar

Bo Frederiksen bofrede

View GitHub Profile
@bofrede
bofrede / disable_support.js
Last active May 3, 2018 11:40
Disable all styles in a @supports rule.
function disable_support(supports_condition) {
for (var si = 0; si < document.styleSheets.length; si++) {
window.console.log("Looking in " + document.styleSheets[si].href);
var rules = document.styleSheets[si].cssRules;
for(var i = 0; i < rules.length; i++) {
if (rules[i].type === 12 && rules[i].conditionText.match(supports_condition)) {
window.console.log("Removing style index " + i);
document.styleSheets[0].deleteRule(i);
}
}