4 <script src=
"../resources/runner.js"></script>
6 var spec
= PerfTestRunner
.loadFile("../Parser/resources/html5.html");
9 PerfTestRunner
.measureTime({
10 description
: "Measures performance of traversing through a large HTML document using elem.childNodes.",
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();
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
); }});