In the spirit of the content-to-markup ratio bookmarklet, here's another one that gives you some more data points to help you judge the quality of a page's markup and help answer the old question - where does all this page weight go.
Install the statsy bookmarklet
Drag this link to your bookmarks:
the results
Once you run the bookmarklet it alerts these stats points:
JS attributes (e.g. onclick)
- this is the sum of allonclick
,onmouseover
and so on including the attribute names. So for example<a onclick="#">
is 11 characters (bytes) of JavaScript attributes codeCSS style attributes
- the sum of allstyle="..."
Inline JS
- the sum of all the contents of all script tags (excluding the tag itself)Inline CSS
- sum of all<style>
tag contentsAll innerHTML
- this isdocument.documentElement.innerHTML.length
, it should be close to the ungzipped size of a page, provided the page is not doing a lot of DOM manipulation# DOM elements
- the total number of elements on the page is counted simply usingdocument.getElementsByTagName('*').length
Here's example output:
The code
The code is here for your tweaking pleasure
Thanks!
Hope you'll find this bookmarklet useful when looking at a page as a companion to YSlow/PageSpeed.
What else should I add to this bookmarklet? # of font tags, # of table tags...?
Comments? Find me on BlueSky, Mastodon, LinkedIn, Threads, Twitter