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 = 256; 14 var nLoops = 100; 15 var classNames = ['A', 'B', 'C', 'D', 'E']; 16 17 function setup() 18 { 19 var nDivs = numDivsInHost; 20 21 for (var i = 0; i < nDivs; ++i) { 22 var div = document.createElement('div'); 23 div.appendChild(document.createTextNode('div' + i)); 24 25 var names = new Array(); 26 for (var j = 0; j < classNames.length; ++j) { 27 if (i & (1 << j)) 28 names.push(classNames[j]); 29 } 30 div.className = names.join(' '); 31 32 host.appendChild(div); 33 } 34 35 var shadowRoot = host.webkitCreateShadowRoot(); 36 for (var i = 0; i < classNames.length; ++i) { 37 var content = document.createElement('content'); 38 content.setAttribute('select', '.' + classNames[i]); 39 shadowRoot.appendChild(content); 40 } 41 shadowRoot.appendChild(document.createElement('content')); 42 } 43 44 function run() 45 { 46 var host = document.getElementById('host'); 47 var nLoops = window.nLoops; 48 49 var div = document.createElement('div'); 50 for (var i = 0; i < nLoops; ++i) { 51 host.appendChild(div); 52 host.removeChild(div); 53 host.offsetLeft; 54 } 55 } 56 57 function done() 58 { 59 wrapper.innerHTML = ''; 60 } 61 62 63 setup(); 64 65 PerfTestRunner.measureTime({ 66 description: "Measure Distribution and Layout time in a case there are multiple InsertionPoints", 67 run: run, 68 done: done 69 }); 70 </script> 71 </body> 72 </html> 73