Editing jQ.Mobi 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) Edits: Added raw JS baseline, innerHTML style, a prototype modifying method, and now prototype.js itself. Actually, in attempting to add the prototype version, I decided that it's too different, even as a pretty well versed javascript developer. This is precisely that I'm talking about: // The old way: var a = document.createElement('a'); a.setAttribute('href', '/foo.html'); a.appendChild(document.createTextNode("Next page")); // The prototype way: var a = new Element('a', {'class': 'foo', href: '/foo.html'}).update("Next page"); WTH .update? Personally .text or .innerText is far too commonplace. prototype is great, but I'd rather see a jQ.Mobi re-write that heavily uses prototypes of native objects. ------------------------------------------------ - reverted to regular jquery.min - moved emptying the container HTML to 'teardown' - micro optimization; replaced i++ with i += 1 Someone please change jquery to jquery mobile. Revision 25 had an error. 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="//staging-ian.appmobi.com/game/zepto.min.js"> </script> <script src="//staging-ian.appmobi.com/game/jq.mobi.min.js"> </script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <div id="container"> </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) var d = document; d.id = function(el) { return d.getElementById(el); } HTMLElement.prototype.append = function(el) { this.appendChild(el); } var jp = {}; //jp, jquery style syntax, utilizing prototypes jp.create = function(el) { return d.createElement(el); } Define teardown for all tests (runs after each clocked test loop, outside of the timed code region) (see FAQ) document.getElementById("container").innerHTML = ""; Code snippets to compare Test 1 Title Async (check if this is an asynchronous test) Code var ul = jq("<ul/>"); var i; for (i = 0; i < 100; i += 1) { var li = jq("<li>hello world jq.Mobi</li>"); ul.append(li); } jq("#container").append(ul); Test 2 Title Async (check if this is an asynchronous test) Code var ul = jQuery("<ul/>"); var i; for (i = 0; i < 100; i += 1) { var li = jQuery("<li>hello world jQuery</li>"); ul.append(li); } jQuery("#container").append(ul); Test 3 Title Async (check if this is an asynchronous test) Code var ul = Zepto("<ul/>"); var i; for (i = 0; i < 100; i += 1) { var li = Zepto("<li>hello world Zepto</li>"); Zepto(ul).append(li); } Zepto("#container").append(ul); Test 4 Title Async (check if this is an asynchronous test) Code var ul = document.createElement("ul"); var i; for (i = 0; i < 100; i += 1) { var li = document.createElement("li"); li.innerText = 'hello world raw JS'; ul.appendChild(li); } d.id("container").appendChild(ul); Test 5 Title Async (check if this is an asynchronous test) Code var ul = "<ul>", i; for (i = 0; i < 100; i++) { var li = "<li>hello world NoFramework</li>"; ul += li; } ul += "</ul>"; d.id("container").innerHTML = ul; Test 6 Title Async (check if this is an asynchronous test) Code var ul = jp.create("ul"); var i; for (i = 0; i < 100; i += 1) { var li = jp.create("li"); li.innerText = 'hello world raw JS'; ul.append(li); } d.id("container").append(ul);