Created
December 29, 2012 04:05
-
-
Save javan/4404503 to your computer and use it in GitHub Desktop.
Remove :hover styles from mobile browsers
This file contains hidden or 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 | |
idxs = [] | |
# detect hover rules | |
for rule, idx in stylesheet.cssRules | |
if rule.type is CSSRule.STYLE_RULE and ignore.test(rule.selectorText) | |
idxs.unshift idx | |
# delete hover rules | |
stylesheet.deleteRule idx for idx in idxs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just wanted to point anyone who lands here to https://gist.github.com/sweatpantsninja/5400379, which is based on this gist but only removes the specific selectors with :hover, rather than the entire css rule.