Re: iframe ... does it have an innerHTML ?

Jeremy Kitchen
Thu, 06 Jul 2006 16:50:45 -0000

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 ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org

http://www.pirate-party.us/ -- defend your rights