-
-
Save sinak/0050ae57d02df85f3503 to your computer and use it in GitHub Desktop.
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
if 'createTouch' of document | |
ignore = /:hover\b/ | |
try | |
for stylesheet in document.styleSheets | |
idxsToDelete = [] | |
# detect hover rules | |
for rule, idx in stylesheet.cssRules | |
if rule.type is CSSRule.STYLE_RULE and ignore.test(rule.selectorText) | |
newSelector = _.reject rule.selectorText.split(","), (s) -> ignore.test s | |
if newSelector.length > 0 | |
newRule = newSelector.join(",").concat rule.cssText.substr(rule.cssText.indexOf("{")) | |
stylesheet.deleteRule idx | |
stylesheet.insertRule newRule, idx | |
else | |
idxsToDelete.unshift idx | |
# delete hover rules | |
stylesheet.deleteRule idx for idx in idxsToDelete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment