On Mon, Sep 28, 2009 at 6:44 PM, Michael Dale <md...@wikimedia.org> wrote: .. > I think both are useful and I like jquery style building of html since > it gives you direct syntax errors rather than html parse errors which > are not as predictable across browsers. But sometimes performance wise > or from a quick "get it working" perspective its easier to write out an > html string. Also I think tabbed html is a bit easier on the eyes for > someone that has dealt a lot with html.
probabbly not the intend of your message, but your first and second examples can be mixed function dojBuild2(){ var box = document.createElement("div"); for(var i =0 ;i < repetCount;i++){ var thing = document.createElement("span"); thing.innerHTML ='<span id="' + escape(i) + '" class="fish">' + '<p class="dog" rel="foo" >' + escape(i) + '</p>' + '</span>'; box.appendChild(thing); } document.getElementById("cat").appendChild(box); } what I think we have here, is that $('#cat') is expensive, and run inside a loop in dojBuild Since your post is about coding style, and not perfomance (and not about the particular speed of this style), ignore this post. -- -- ℱin del ℳensaje. _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l