WebPagetest Forums
Dom elements count - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Discuss Test Results (/forumdisplay.php?fid=4)
+--- Thread: Dom elements count (/showthread.php?tid=12353)



Dom elements count - ninjaste - 06-24-2013 06:04 PM

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


RE: Dom elements count - pmeenan - 06-26-2013 04:34 AM

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.


RE: Dom elements count - ninjaste - 06-26-2013 04:00 PM

The issue seems to happen with IE9 agent.

If I run the test on http://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


RE: Dom elements count - pmeenan - 06-28-2013 12:42 AM

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).