Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / PerformanceTests / DOM / TraverseChildNodes.html
blob069aa04f82e74c0f5d9689919020264b74ee9267
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/runner.js"></script>
5 <script>
6 var spec = PerfTestRunner.loadFile("../Parser/resources/html5.html");
7 var iframe;
9 PerfTestRunner.measureTime({
10 description: "Measures performance of traversing through a large HTML document using elem.childNodes.",
11 setup: function () {
12 if (iframe)
13 document.body.removeChild(iframe);
14 iframe = document.createElement("iframe");
15 iframe.style.display = "none"; // Prevent creation of the rendering tree, so we only test HTML parsing.
16 iframe.sandbox = ''; // Prevent external script loads which could cause write() to return before completing the parse.
17 document.body.appendChild(iframe);
18 iframe.contentDocument.open();
19 iframe.contentDocument.write(spec);
20 iframe.contentDocument.close();
22 run: function() {
23 var elements = iframe.contentDocument.getElementsByTagName('*');
24 for (var i = 0; i < elements.length; i++) {
25 for (var j = 0; j < elements[i].childNodes.length; j++)
26 elements[i].childNodes[j];
29 done: function () { document.body.removeChild(iframe); }});
31 </script>
32 </body>
33 </html>