Dom elements count

Hello,

I’m using webpagetest for some testing, and I’m comparing it with Chrome dev tools.
There is a thing I don’t understand, the dom elements metric given by webpagetest on a web site I have tested recently tells me 3060 DOM elements, see test result

http://www.webpagetest.org/result/130624_R0_CFP/

while using Google Chrome dev tools and the command

document.getElementsByTagName(“*”).length

I got only 1337 elements.
What causes this huge difference?

Thanks in advance and congrats for the really nice tool!

Stefano

That’s pretty strange because that’s exactly what WebPagetest runs:

https://code.google.com/p/webpagetest/source/browse/trunk/agent/browser/chrome/extension/wpt/script.js#87

I’ll take a look and see if anything jumps out at me but I don’t have a good explanation unless it is something platform-specific or the content was a bit different.

The issue seems to happen with IE9 agent.

If I run the test on www.lancia.it with Chrome or Firefox agent, the DOM count is correct (same as document.getElementsByTagName(“*”).length )

But if I run the test with IE9, then I get too much DOM elements

http://www.webpagetest.org/result/130626_HQ_868/

Maybe IE9 is computing something different from document.getElementsByTagName(“*”).length?

Hope this helps finding the problem.

Thanks again,

Stefano

Yes, unloke the other browsers, the IE agent can walk into cross-domain iframes and count the DOM elements inside of them as well. I’m fairly confident that there is no double-counting going on (but I’ll verify) but the difference should come from any iframes on the page (the social stuff at the bottom of your page are all in cross-domain iframes).