Some improvements to the closest perf tests - works in all browsers now.
This commit is contained in:
parent
0ca35de311
commit
96d8c481b8
|
@ -10,15 +10,16 @@
|
||||||
jQuery(function ready() {
|
jQuery(function ready() {
|
||||||
var node = $("#child"), name;
|
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 + "'";
|
name = "closest '" + item + "'";
|
||||||
console.log(name);
|
|
||||||
|
|
||||||
console.log("new", benchmarkString("$('#child').closest('" + item + "')", 5000, name));
|
jQuery("#results").append("<li>" + name + "<ul>" +
|
||||||
console.log("old", benchmarkString("old('#child').closest('" + item + "')", 5000, name));
|
"<li>new: " + benchmarkString("$('#child').closest('" + item + "')", 500, name) + "</li>" +
|
||||||
|
"<li>old: " + benchmarkString("old('#child').closest('" + item + "')", 500, name) + "</li>"
|
||||||
|
+ "</ul></li>");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ul id="results"></ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue