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; 8 9 PerfTestRunner.measureTime({ 10 setup: function () { 11 if (iframe) 12 document.body.removeChild(iframe); 13 iframe = document.createElement("iframe"); 14 iframe.style.display = "none"; // Prevent creation of the rendering tree, so we only test HTML parsing. 15 iframe.sandbox = ''; // Prevent external script loads which could cause write() to return before completing the parse. 16 document.body.appendChild(iframe); 17 iframe.contentDocument.open(); 18 iframe.contentDocument.write(spec); 19 iframe.contentDocument.close(); 20 }, 21 run: function() { 22 var elements = iframe.contentDocument.getElementsByTagName('*'); 23 for (var i = 0; i < elements.length; i++) { 24 for (var j = 0; j < elements[i].childNodes.length; j++) 25 elements[i].childNodes[j]; 26 } 27 }, 28 done: function () { document.body.removeChild(iframe); }}); 29 30 </script> 31 </body> 32 </html> 33