On 17/12/10 12:19, Balázs Galambosi wrote: Stoyan in his jsconf talk warns everyone to reconsider "common myths" of performance optimization. This is exactly the case here. In fact Webkit based browsers are generally 3x faster with DOM methods than with innerHTML.
Also, I personally find it more convenient to use DOM methods, for when you create an element in the DOM then you already have it referenced for further manipulation (someone said "lazyness helps build progress", loosely quoted). Besides -in my newbie experience- creating/manipulating elements using DOM methods makes me understand better the structure and element relations of what I'm doing, even if it's more time-consuming and verbose than innerHTML. And as a strictly empirical/esthetic consideration, to me using DOM methods feels like 'cleaner' code than innerHTML - and more entertaining to write. It depends a lot on what exactly has to be accomplished, though, right? My most extensive DOM manipulation so far has been for a Javascript-based chatroom in a pre-js libraries era, where most elements were constantly updated... I heavily suspect using innerHTML would have made a nasty mess of the code in that specific case, while it may be more suitable than DOM methods under different conditions. A good day to you all, Flavia -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
