This article mainly introduces the code for implementing CSS coverage test scripts. It has certain reference value. Now I share it with you. Friends in need can refer to it.
Here we only ask for CSS rules. Coverage, so just access querySelectorAll().length. By sorting, you can see the usage of each CSS
document.styleSheets stores a collection of all CSS rules on the current page. Through it, you can traverse all selectors defined in the page