On Feb 6, 8:23 pm, Miller Medeiros <lis...@millermedeiros.com> wrote:
> On Sun, Feb 6, 2011 at 1:54 PM, Jorge <jo...@jorgechamorro.com> wrote:
> > On Feb 6, 4:25 pm, Diego Perini <diego.per...@gmail.com> 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"...

Yes. And that's all right. Those are good reasons to use the DOM
methods instead of innerHTML. But I wanted to point out that unlike in
IEs there's not any problem(s) with innerHTML in Chrome nor in Safari
nor in Firefox nor in Opera. Only in Microsoft's Internet Explorer(s).
--
Jorge.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to