1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="../resources/runner.js"></script> 5 <style> 6 7 #container { 8 display: flex; 9 flex-wrap: wrap; 10 } 11 12 .byteBox { 13 width: 9px; 14 font-size: 9px; 15 } 16 17 .inlineBlock { 18 font-family: Ahem; 19 width: 100%; 20 display: inline-block; 21 } 22 23 </style> 24 </head> 25 <body> 26 27 <div id="container" style=""> 28 </div> 29 30 </body> 31 <script> 32 33 var nbsp = '\u00A0'; 34 35 function setupTest() 36 { 37 var container = document.getElementById("container"); 38 for (var i = 0; i < 200; i++) { 39 var div = document.createElement("div"); 40 div.className = "byteBox"; 41 var span = document.createElement("span"); 42 span.className = "inlineBlock"; 43 span.innerText = nbsp; 44 div.appendChild(span); 45 container.appendChild(div); 46 }; 47 }; 48 49 setupTest(); 50 51 var switcher = true; 52 53 function runTest() 54 { 55 var inlineBlocks = document.getElementsByClassName("inlineBlock"); 56 for (var i = inlineBlocks.length - 1; i >= 0; i--) { 57 inlineBlocks[i].innerText = switcher ? " " : nbsp; 58 inlineBlocks[i].offsetTop; 59 }; 60 switcher = !switcher; 61 }; 62 63 PerfTestRunner.measureRunsPerSecond({run: runTest }); 64 </script> 65 </html> 66