Editing various js libraries+native selector shootout This edit will create a new revision. Your details (optional) Name Email (won’t be displayed; might be used for Gravatar) URL Test case details Title * Published (uncheck if you want to fiddle around before making the page public) Description (in case you feel further explanation is needed)(Markdown syntax is allowed) Hide 10 nodes. Are you a spammer? (just answer the question) Preparation code Preparation code HTML (this will be inserted in the <body> of a valid HTML5 document in standards mode) (useful when testing DOM operations or including libraries) <script src="//cdn.jqmobi.com/1.2/jq.mobi.min.js"></script> <script src="//yui.yahooapis.com/3.8.1/build/yui/yui-min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script> <div id="sidebar"> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> <span class="foo">Foo</span> </div> <div id="list"> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> <span class="bar">Bar</span> </div> <div id="details"> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> <span class="baz">Baz</span> </div> Include JavaScript libraries as follows: <script src="//cdn.ext/library.js"></script> Define setup for all tests (variables, functions, arrays or other objects that will be used in the tests) (runs before each clocked test loop, outside of the timed code region) (e.g. define local test variables, reset global variables, clear canvas, etc.) (see FAQ) yQuery = YUI().use('node'); qQuery = jq; zQuery = Zepto; Define teardown for all tests (runs after each clocked test loop, outside of the timed code region) (see FAQ) Code snippets to compare Test 1 Title Async (check if this is an asynchronous test) Code var nodes = document.querySelectorAll("#details > span"); for (var i = nodes.length; i--;) { nodes[i].style.display = "none"; } Test 2 Title Async (check if this is an asynchronous test) Code var nodes = document.querySelectorAll("#details > span"); for (var i = 0, len = nodes.length; i < len; i++) { nodes[i].style.display = "none"; } Test 3 Title Async (check if this is an asynchronous test) Code var nodes = document.querySelectorAll("#details > span"); for (var i = 0; i < nodes.length; i++) { nodes[i].style.display = "none"; } Test 4 Title Async (check if this is an asynchronous test) Code var nodes = document.querySelectorAll(".baz"); for (var i = nodes.length; i--;) { nodes[i].style.display = "none"; } Test 5 Title Async (check if this is an asynchronous test) Code var nodes = document.querySelectorAll(".baz"); for (var i = 0, len = nodes.length; i < len; i++) { nodes[i].style.display = "none"; } Test 6 Title Async (check if this is an asynchronous test) Code var nodes = document.querySelectorAll(".baz"); for (var i = 0; i < nodes.length; i++) { nodes[i].style.display = "none"; } Test 7 Title Async (check if this is an asynchronous test) Code var nodes = document.getElementById("details").getElementsByTagName("span"); for (var i = nodes.length; i--;) { nodes[i].style.display = "none"; } Test 8 Title Async (check if this is an asynchronous test) Code var nodes = document.getElementById("details").getElementsByTagName("span"); for (var i = 0, len = nodes.length; i < len; i++) { nodes[i].style.display = "none"; } Test 9 Title Async (check if this is an asynchronous test) Code var nodes = document.getElementById("details").getElementsByTagName("span"); for (var i = 0; i < nodes.length; i++) { nodes[i].style.display = "none"; } Test 10 Title Async (check if this is an asynchronous test) Code var nodes = document.getElementsByClassName("baz"); for (var i = nodes.length; i--;) { nodes[i].style.display = "none"; } Test 11 Title Async (check if this is an asynchronous test) Code var nodes = document.getElementsByClassName("baz"); for (var i = 0, len = nodes.length; i < len; i++) { nodes[i].style.display = "none"; } Test 12 Title Async (check if this is an asynchronous test) Code var nodes = document.getElementsByClassName("baz"); for (var i = 0; i < nodes.length; i++) { nodes[i].style.display = "none"; } Test 13 Title Async (check if this is an asynchronous test) Code zQuery("#details > span").hide(); Test 14 Title Async (check if this is an asynchronous test) Code zQuery(".baz").hide(); Test 15 Title Async (check if this is an asynchronous test) Code jQuery("#details > span").hide(); Test 16 Title Async (check if this is an asynchronous test) Code jQuery(".baz").hide(); Test 17 Title Async (check if this is an asynchronous test) Code yQuery.all("#details > span").hide(); Test 18 Title Async (check if this is an asynchronous test) Code yQuery.all(".baz").hide(); Test 19 Title Async (check if this is an asynchronous test) Code qQuery("#details > span").hide(); Test 20 Title Async (check if this is an asynchronous test) Code qQuery(".baz").hide();