1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script type="text/javascript" src="../resources/runner.js"></script> 5 </head> 6 <body> 7 8 <div id="wrapper"> 9 <div id="host"></div> 10 </div> 11 12 <script> 13 var numDivsInHost = 100; 14 var nLoops = 1000; 15 16 function setup() 17 { 18 var nDivs = numDivsInHost; 19 20 for (var i = 0; i < nDivs; ++i) { 21 var div = document.createElement('div'); 22 div.appendChild(document.createTextNode('div' + i)); 23 if (i % 2 == 0) 24 div.className = 'selected'; 25 host.appendChild(div); 26 } 27 28 var shadowRoot = host.webkitCreateShadowRoot(); 29 shadowRoot.innerHTML = ''; 30 31 var host2 = shadowRoot.getElementById('host2'); 32 var shadowRoot2 = host2.webkitCreateShadowRoot(); 33 shadowRoot2.innerHTML = ''; 34 } 35 36 function run() 37 { 38 var host = document.getElementById('host'); 39 var nLoops = window.nLoops; 40 41 var div = document.createElement('div'); 42 for (var i = 0; i < nLoops; ++i) { 43 host.appendChild(div); 44 host.removeChild(div); 45 host.offsetLeft; 46 } 47 } 48 49 function done() 50 { 51 wrapper.innerHTML = ''; 52 } 53 54 setup(); 55 56 PerfTestRunner.measureTime({ 57 description: "Measure performance of content reprojection and distribution", 58 run: run, 59 done: done 60 }); 61 </script> 62 </body> 63 </html> 64