Home | History | Annotate | Download | only in ShadowDOM
      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 = 1000;
     14 var nLoops = 30;
     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         host.appendChild(div);
     24     }
     25 
     26     window.content = document.createElement('content');
     27     var shadowRoot = host.webkitCreateShadowRoot();
     28     shadowRoot.appendChild(content);
     29 }
     30 
     31 function run()
     32 {
     33     var host = document.getElementById('host');
     34     var content = window.content;
     35     var nLoops = window.nLoops;
     36 
     37     var div = document.createElement('div');
     38     for (var i = 0; i < nLoops; ++i) {
     39         host.appendChild(div);
     40         host.removeChild(div);
     41         content.getDistributedNodes();
     42     }
     43 }
     44 
     45 function done()
     46 {
     47     wrapper.innerHTML = '';
     48 }
     49 
     50 setup();
     51 
     52 PerfTestRunner.measureRunsPerSecond({
     53     description: "Measure Distribution (without layout time) with a lot of host children",
     54     run: run,
     55     done: done
     56 });
     57 </script>
     58 </body>
     59 </html>
     60