レンダリング後のタグの階層とその数を調べたかったので、作ってみました。
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
var myTag = {};
function myTags(elm, tg) {
tg += (tg===''?'':'>')+$(elm).prop('tagName');
if (typeof(myTag[tg])==='undefined') myTag[tg] = 0;
myTag[tg]++;
if ($(elm).children().length) {
$(elm).children().each(function() {
myTags(this, tg);
});
}
}
$(function() {
var tg = '';
myTags($('html'), tg);
for (var tg in myTag) {
console.log(tg + ':' + myTag[tg]);
}
});
</script>