1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Measure :focus update for a simple color change</title> 5 <script src="../resources/runner.js"></script> 6 <style type="text/css"> 7 body { margin: 0 } 8 a { color: black; } 9 a:focus { color: red; } 10 </style> 11 </head> 12 <body> 13 <script> 14 for (var i=0; i<100; i++) { 15 document.write(''); 16 for (var j=0; j<100; j++) 17 document.write('<a></a>'); 18 document.write('</div>'); 19 } 20 </script> 21 <div id="test"><a href="."></a><a href="."></div></div> 22 <script type="text/javascript"> 23 document.body.offsetTop; // Force layout. 24 25 var testDiv = document.getElementById("test"); 26 var a1 = testDiv.firstChild; 27 var a2 = a1.nextSibling; 28 29 PerfTestRunner.measureRunsPerSecond({ 30 description: "Measure :focus update for a simple color change", 31 run:function() { 32 a1.focus(); 33 document.body.offsetTop; // Update layout for focused state. 34 a2.focus(); 35 document.body.offsetTop; // Update layout for focused state. 36 }}); 37 </script> 38 </body> 39 </html> 40