aboutsummaryrefslogtreecommitdiffstats
path: root/speed/closest.html
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-10-10 13:22:39 -0400
committerjeresig <jeresig@gmail.com>2010-10-10 13:22:39 -0400
commit96d8c481b8cf64eb7ba789fce709e655f7706fd7 (patch)
tree215a5970c950e6aa842a725d8301a6afca8ffadf /speed/closest.html
parent0ca35de311ff4d1dac5c9dc4de05a32a1754cd7a (diff)
downloadjquery-96d8c481b8cf64eb7ba789fce709e655f7706fd7.tar.gz
jquery-96d8c481b8cf64eb7ba789fce709e655f7706fd7.zip
Some improvements to the closest perf tests - works in all browsers now.
Diffstat (limited to 'speed/closest.html')
-rw-r--r--speed/closest.html12
1 files changed, 7 insertions, 5 deletions
diff --git a/speed/closest.html b/speed/closest.html
index eacf74935..ca2017480 100644
--- a/speed/closest.html
+++ b/speed/closest.html
@@ -10,15 +10,16 @@
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>