JSFiddle - React, Tailwind, and code Playground

by Csaba Hellinger

HTML

<div id="mydiv1">
    mydiv1
</div>

<div id="mydiv2">
    mydiv2
</div>

CSS

#mydiv1:hover {
    background-color: pink;
}

#mydiv2 {
    background-color: yellow;
}

JavaScript

var iSheet, sheet, iRule, rules, rule;

console.clear();

for (iSheet=0; iSheet<document.styleSheets.length; iSheet++) {
    sheet = document.styleSheets[iSheet];
    rules = sheet.rules || sheet.cssRules;
    for (iRule=0; iRule<rules.length; iRule++) {
        rule = rules[iRule];        
        if (rule.selectorText.indexOf(":hover") > -1) {
            console.log(rule.cssText);
        }
    }
}