On Wednesday 28 June 2006 07:53, Martinez, Andrew wrote: > Most people agree, that creating textNodes is the correct way to handle > adding text to a DOM node. Other than that here are the arguments: > > Using innerHTML: you could use innerHTML += "my text" to append text as well > and that will just create a new text node for you.
well, if you have any event handlers on the nodes contained by the node you're doing .innerHTML on, it will destroy those as well, since it doesn't just automagically create a new text node, it replaces the old innerHTML with the new innerHTML and then parses it looking for nodes. oh, and you leak memory if there were event handlers there as well :( innerHTML is evil! But, unfortunately, very convenient, and in almost every browser available, far far faster than using 'proper' DOM manipulation. -Jeremy -- Jeremy Kitchen ++ [EMAIL PROTECTED] http://www.pirate-party.us/ -- defend your rights
pgpOPHlwCqtLP.pgp
Description: PGP signature
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs