Should improve performance of closest considerably. Benchmark proof in speed/closest...
[jquery.git] / speed / closest.html
1 <!doctype html>
2 <html>
3 <head>
4         <title>Test Event Handling 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>
9   <script>
10     jQuery(function ready() {
11       var node = $("#child"), name;
12
13       [".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"].forEach(function foreach(item) {
14         name = "closest '" + item + "'";
15         console.log(name);
16
17         console.log("new", benchmarkString("$('#child').closest('" + item + "')", 5000, name));
18         console.log("old", benchmarkString("old('#child').closest('" + item + "')", 5000, name));
19       });
20     });
21         </script>
22 </head>
23 <body>
24   <div>
25     <p>Hello</p>
26     <div class="zoo" id="zoo" data-foo="bar">
27       <div>
28         <p id="child">lorem ipsum</p>
29         <p>dolor sit amet</p>
30       </div>
31     </div>
32   </div>
33 </body>
34 </html>
35