]> source.dussan.org Git - jquery.git/commitdiff
Some improvements to the closest perf tests - works in all browsers now.
authorjeresig <jeresig@gmail.com>
Sun, 10 Oct 2010 17:22:39 +0000 (13:22 -0400)
committerjeresig <jeresig@gmail.com>
Sun, 10 Oct 2010 17:22:39 +0000 (13:22 -0400)
speed/closest.html

index eacf74935ed47d2bfb138d3c8cdf56b8c19b12cd..ca2017480b2ea8e8adedece6a28e26b2425211e4 100644 (file)
     jQuery(function ready() {
       var node = $("#child"), name;
 
-      [".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"].forEach(function foreach(item) {
+      jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
         name = "closest '" + item + "'";
-        console.log(name);
 
-        console.log("new", benchmarkString("$('#child').closest('" + item + "')", 5000, name));
-        console.log("old", benchmarkString("old('#child').closest('" + item + "')", 5000, name));
+       jQuery("#results").append("<li>" + name + "<ul>" +
+               "<li>new: " + benchmarkString("$('#child').closest('" + item + "')", 500, name) + "</li>" +
+               "<li>old: " + benchmarkString("old('#child').closest('" + item + "')", 500, name) + "</li>"
+               + "</ul></li>");
       });
     });
-       </script>
+  </script>
 </head>
 <body>
   <div>
@@ -30,6 +31,7 @@
       </div>
     </div>
   </div>
+  <ul id="results"></ul>
 </body>
 </html>