Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (36 sloc) 1.044 kb
0ca35de @wycats Should improve performance of closest considerably. Benchmark proof in s...
wycats authored
1 <!doctype html>
2 <html>
3 <head>
63c892b @jeresig Make some more tweaks to the closest perf test suite.
jeresig authored
4 <title>Test .closest() Performance</title>
0ca35de @wycats Should improve performance of closest considerably. Benchmark proof in s...
wycats authored
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
96d8c48 @jeresig Some improvements to the closest perf tests - works in all browsers now.
jeresig authored
13 jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
63c892b @jeresig Make some more tweaks to the closest perf test suite.
jeresig authored
14 setTimeout(function(){
15 name = "closest '" + item + "'";
0ca35de @wycats Should improve performance of closest considerably. Benchmark proof in s...
wycats authored
16
63c892b @jeresig Make some more tweaks to the closest perf test suite.
jeresig authored
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>"
20 + "</ul></li>");
21 }, 100);
0ca35de @wycats Should improve performance of closest considerably. Benchmark proof in s...
wycats authored
22 });
23 });
96d8c48 @jeresig Some improvements to the closest perf tests - works in all browsers now.
jeresig authored
24 </script>
0ca35de @wycats Should improve performance of closest considerably. Benchmark proof in s...
wycats authored
25 </head>
26 <body>
27 <div>
28 <p>Hello</p>
29 <div class="zoo" id="zoo" data-foo="bar">
30 <div>
31 <p id="child">lorem ipsum</p>
32 <p>dolor sit amet</p>
33 </div>
34 </div>
35 </div>
96d8c48 @jeresig Some improvements to the closest perf tests - works in all browsers now.
jeresig authored
36 <ul id="results"></ul>
0ca35de @wycats Should improve performance of closest considerably. Benchmark proof in s...
wycats authored
37 </body>
38 </html>
39
Something went wrong with that request. Please try again.