Created
May 10, 2021 04:04
-
-
Save nolanlawson/ac589bbe512c3efa9306574ce62a06a5 to your computer and use it in GitHub Desktop.
Count stats on a web page
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
({ | |
numNodes: $$('*').length, | |
numCustomElements: $$('*').filter(_ => customElements.get(_.tagName.toLowerCase())).length, | |
numUniqueCustomElements: [...new Set([...$$('*').map(_ => _.tagName.toLowerCase())])].filter(_ => customElements.get(_)).length, | |
numRulesWithoutCrossOrigin: [...document.styleSheets].map(_ => { try { return _.cssRules.length } catch (e) { return 0 }}).reduce((a, b) => a + b, 0) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment