Created
April 29, 2016 15:58
-
-
Save SaulDoesCode/aaa0beead88e592e8996a8a31529b470 to your computer and use it in GitHub Desktop.
add or revoke css rules from sheets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CSSRule(index, selector, rules, sheet) { | |
if (toString.call(rules) === '[object Object]') { | |
let temp = ''; | |
for(let key in rules) temp += key + ': ' + (rules[key].includes(';') ? rules[key] : rules[key] + ';\n'); | |
rules = temp | |
} | |
sheet.insertRule(selector + "{" + rules + "}", index) | |
} | |
function revokeCSSRule(index, sheet) { | |
sheet.sheet.deleteRule(index) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment