Permalink
Browse files

Fix indentation in /speed and /test dirs, closes gh-780.

  • Loading branch information...
1 parent c4df0c9 commit f1dcaad09736c194f9148e5bf5fb08498a483a7a @treyhunner treyhunner committed with dmethvin May 18, 2012
View
@@ -5,11 +5,11 @@ function benchmark(fn, times, name){
e = fn.lastIndexOf('}');
fn = fn.substring(s,e);
- return benchmarkString(fn, times, name);
+ return benchmarkString(fn, times, name);
}
function benchmarkString(fn, times, name) {
- var fn = new Function("i", "var t=new Date; while(i--) {" + fn + "}; return new Date - t")(times)
- fn.displayName = name || "benchmarked";
- return fn;
+ var fn = new Function("i", "var t=new Date; while(i--) {" + fn + "}; return new Date - t")(times)
+ fn.displayName = name || "benchmarked";
+ return fn;
}
View
@@ -1,10 +1,10 @@
- .dialog {
- margin-bottom: 1em;
- }
- a.expand {
- background: #e3e3e3;
- }
+ .dialog {
+ margin-bottom: 1em;
+ }
+ a.expand {
+ background: #e3e3e3;
+ }
div#time-test {
font-family: Arial, Helvetica, sans-serif;
@@ -42,14 +42,14 @@
text-align: center;
}
- #time-test {
- margin: 1em 0;
- padding: .5em;
- background: #e3e3e3;
- }
- #time-taken {
- font-weight: bold;
- }
+ #time-test {
+ margin: 1em 0;
+ padding: .5em;
+ background: #e3e3e3;
+ }
+ #time-taken {
+ font-weight: bold;
+ }
span.wins {
color: #330;
@@ -62,4 +62,4 @@
div.buttons {
margin-top: 10px;
margin-bottom: 10px;
- }
+ }
View
@@ -1,41 +1,41 @@
jQuery.benchmarker.tests = [
- // Selectors from:
- // http://ejohn.org/blog/selectors-that-people-actually-use/
- /*
- // For Amazon.com
- "#navAmazonLogo", "#navSwmSkedPop",
- ".navbar", ".navGreeting",
- "div", "table",
- "img.navCrossshopTabCap", "span.navGreeting",
- "#navbar table", "#navidWelcomeMsg span",
- "div#navbar", "ul#navAmazonLogo",
- "#navAmazonLogo .navAmazonLogoGatewayPanel", "#navidWelcomeMsg .navGreeting",
- ".navbar .navAmazonLogoGatewayPanel", ".navbar .navGreeting",
- "*",
- "#navAmazonLogo li.navAmazonLogoGatewayPanel", "#navidWelcomeMsg span.navGreeting",
- "a[name=top]", "form[name=site-search]",
- ".navbar li", ".navbar span",
- "[name=top]", "[name=site-search]",
- "ul li", "a img",
- "#navbar #navidWelcomeMsg", "#navbar #navSwmDWPop",
- "#navbar ul li", "#navbar a img"
- */
- // For Yahoo.com
- "#page", "#masthead", "#mastheadhd",
- ".mastheadbd", ".first", ".on",
- "div", "li", "a",
- "div.mastheadbd", "li.first", "li.on",
- "#page div", "#dtba span",
- "div#page", "div#masthead",
- "#page .mastheadbd", "#page .first",
- ".outer_search_container .search_container", ".searchbox_container .inputtext",
- "*",
- "#page div.mastheadbd", "#page li.first",
- "input[name=p]", "a[name=marketplace]",
- ".outer_search_container div", ".searchbox_container span",
- "[name=p]", "[name=marketplace]",
- "ul li", "form input",
- "#page #e2econtent", "#page #e2e"
+ // Selectors from:
+ // http://ejohn.org/blog/selectors-that-people-actually-use/
+ /*
+ // For Amazon.com
+ "#navAmazonLogo", "#navSwmSkedPop",
+ ".navbar", ".navGreeting",
+ "div", "table",
+ "img.navCrossshopTabCap", "span.navGreeting",
+ "#navbar table", "#navidWelcomeMsg span",
+ "div#navbar", "ul#navAmazonLogo",
+ "#navAmazonLogo .navAmazonLogoGatewayPanel", "#navidWelcomeMsg .navGreeting",
+ ".navbar .navAmazonLogoGatewayPanel", ".navbar .navGreeting",
+ "*",
+ "#navAmazonLogo li.navAmazonLogoGatewayPanel", "#navidWelcomeMsg span.navGreeting",
+ "a[name=top]", "form[name=site-search]",
+ ".navbar li", ".navbar span",
+ "[name=top]", "[name=site-search]",
+ "ul li", "a img",
+ "#navbar #navidWelcomeMsg", "#navbar #navSwmDWPop",
+ "#navbar ul li", "#navbar a img"
+ */
+ // For Yahoo.com
+ "#page", "#masthead", "#mastheadhd",
+ ".mastheadbd", ".first", ".on",
+ "div", "li", "a",
+ "div.mastheadbd", "li.first", "li.on",
+ "#page div", "#dtba span",
+ "div#page", "div#masthead",
+ "#page .mastheadbd", "#page .first",
+ ".outer_search_container .search_container", ".searchbox_container .inputtext",
+ "*",
+ "#page div.mastheadbd", "#page li.first",
+ "input[name=p]", "a[name=marketplace]",
+ ".outer_search_container div", ".searchbox_container span",
+ "[name=p]", "[name=marketplace]",
+ "ul li", "form input",
+ "#page #e2econtent", "#page #e2e"
];
jQuery.fn.benchmark = function() {
@@ -110,7 +110,7 @@
timeArr.push(new Date() - time);
}
var diff = Math.sum(timeArr) - Math.max.apply( Math, timeArr )
- - Math.min.apply( Math, timeArr );
+ - Math.min.apply( Math, timeArr );
try {
var libRes = window[libraries[0]](code);
var jqRes = jQuery(code);
View
@@ -6,34 +6,34 @@
<script src="jquery-basis.js"></script>
<script>var old = jQuery.noConflict(true);</script>
<script src="../dist/jquery.js"></script>
- <script>
- jQuery(function ready() {
- var node = $("#child"), name;
+ <script>
+ jQuery(function ready() {
+ var node = $("#child"), name;
- jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
+ jQuery.each([".zoo", "#zoo", "[data-foo=zoo]", "#nonexistant"], function(i, item) {
setTimeout(function(){
- name = "closest '" + item + "'";
+ name = "closest '" + item + "'";
jQuery("#results").append("<li>" + name + "<ul>" +
- "<li>new: " + benchmarkString("$('#child').closest('" + item + "')", 2500, name) + "</li>" +
- "<li>old: " + benchmarkString("old('#child').closest('" + item + "')", 2500, name) + "</li>"
+ "<li>new: " + benchmarkString("$('#child').closest('" + item + "')", 2500, name) + "</li>" +
+ "<li>old: " + benchmarkString("old('#child').closest('" + item + "')", 2500, name) + "</li>"
+ "</ul></li>");
}, 100);
- });
- });
- </script>
+ });
+ });
+ </script>
</head>
<body>
- <div>
- <p>Hello</p>
- <div class="zoo" id="zoo" data-foo="bar">
- <div>
- <p id="child">lorem ipsum</p>
- <p>dolor sit amet</p>
- </div>
- </div>
- </div>
- <ul id="results"></ul>
+ <div>
+ <p>Hello</p>
+ <div class="zoo" id="zoo" data-foo="bar">
+ <div>
+ <p id="child">lorem ipsum</p>
+ <p>dolor sit amet</p>
+ </div>
+ </div>
+ </div>
+ <ul id="results"></ul>
</body>
</html>
Oops, something went wrong. Retry.

0 comments on commit f1dcaad

Please sign in to comment.