| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/runner.js"></script> | 4 <script src="../resources/runner.js"></script> |
| 5 <style> | 5 <style> |
| 6 .root .child {} | 6 [attr=root] [attr=child] {} |
| 7 </style> | 7 </style> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <div id="root"></div> | 10 <div id="root"></div> |
| 11 <script> | 11 <script> |
| 12 function addChildren(element, numChildren, idPrefix) | 12 function addChildren(element, numChildren, idPrefix) |
| 13 { | 13 { |
| 14 for (var i = 0; i < numChildren; i++) { | 14 for (var i = 0; i < numChildren; i++) { |
| 15 var child = document.createElement("div"); | 15 var child = document.createElement("div"); |
| 16 child.id = idPrefix + i; | 16 child.id = idPrefix + i; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 makeTree(child, depth - 1, fanOut, child.id); | 27 makeTree(child, depth - 1, fanOut, child.id); |
| 28 } | 28 } |
| 29 if (child) | 29 if (child) |
| 30 makeTree(child, depth - 1, fanOut, child.id); | 30 makeTree(child, depth - 1, fanOut, child.id); |
| 31 } | 31 } |
| 32 | 32 |
| 33 var root = document.querySelector("#root"); | 33 var root = document.querySelector("#root"); |
| 34 makeTree(root, 6, 5, "child"); | 34 makeTree(root, 6, 5, "child"); |
| 35 | 35 |
| 36 var child = document.querySelector("#child012341"); | 36 var child = document.querySelector("#child012341"); |
| 37 child.className = "child"; | 37 child.setAttribute("attr", "child"); |
| 38 var runFunction = function() | 38 var runFunction = function() |
| 39 { | 39 { |
| 40 root.offsetHeight; // force recalc style | 40 root.offsetHeight; // force recalc style |
| 41 root.className = "root"; | 41 root.setAttribute("attr" , "root"); |
| 42 root.offsetHeight; | 42 root.offsetHeight; |
| 43 root.className = ""; | 43 root.removeAttribute("attr"); |
| 44 } | 44 } |
| 45 | 45 |
| 46 PerfTestRunner.measureRunsPerSecond({run: runFunction}); | 46 PerfTestRunner.measureRunsPerSecond({run: runFunction}); |
| 47 | 47 |
| 48 </script> | 48 </script> |
| 49 </body> | 49 </body> |
| 50 </html> | 50 </html> |
| OLD | NEW |