On Sun, Feb 6, 2011 at 1:54 PM, Jorge <[email protected]> wrote:

> On Feb 6, 4:25 pm, Diego Perini <[email protected]> wrote:
> >
> > By creating elements using DOM methods you are doing it correctly. If
> > you can completely avoid using ".innerHTML" property you also
> > potentially avoid known problems with it.
>
> innerHTML known problems ? In Chrome/Safari ? No. Sorry but no, sorry.
> Perhaps in IEs...
>

check this out:  http://jsfiddle.net/9TYrw/

this is the reason why I decided to migrate my code to pure DOM.. I have
little amount of markup and a lots of JS and the output is fairly complex
since I'm using HTML5 video, canvas, CSS transitions and animations,
deep-linking, etc..  so for me it's way easier to store references to nodes
inside each section module during the section "build" process and remove
nodes from the document and delete the references during "dispose" (allowing
garbage collection to happen) specially since each section module is an
"static" object (similar to a module pattern) and the references would be
stored during the whole life of the application (I don't like the idea that
unused objects are still being referenced)...

you probably won't have issues with inner HTML if you are querying for the
elements after it, but you cannot ensure that old references would still
point to the proper element... on my specific case I cannot ensure that
since the whole app is event-driven/asynchronous...

PS: another thing is that I find that by using the DOM methods to create
elements it is way clearer that you are dealing with objects and not the
markup... my mind enters on a "different mode"...

-- 
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]

Reply via email to