4 <title>Test .closest() Performance</title>
5 <script src="benchmark.js"></script>
6 <script src="jquery-basis.js"></script>
7 <script>var old = jQuery.noConflict(true);</script>
8 <script src="../dist/jquery.js"></script>
10 jQuery(function ready() {
11 var node = $("#child"), name;
13 jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
14 setTimeout(function(){
15 name = "closest '" + item + "'";
17 jQuery("#results").append("<li>" + name + "<ul>" +
18 "<li>new: " + benchmarkString("$('#child').closest('" + item + "')", 2500, name) + "</li>" +
19 "<li>old: " + benchmarkString("old('#child').closest('" + item + "')", 2500, name) + "</li>"
29 <div class="zoo" id="zoo" data-foo="bar">
31 <p id="child">lorem ipsum</p>
36 <ul id="results"></ul>