Thanks Mike, that is nice to know. Ofcourse all that could go on one line
but I dont find it very readable and will be doing what you mentioned from
now on.

On 9/29/07, Michael Geary <[EMAIL PROTECTED]> wrote:
>
>
> > From: James Dempster
> >
> > I've never really understood the point to FlyDOM. It seems
> > like a nice idea, but whats wrong with just using jQuery?
> >
> > FlyDOM
> > $('#exampleCA').createAppend(
> >     'table', { width: '718px', style: 'border: 2px inset #336699;' }, [
> >         'tr', { className: 'exampleRow' }, [
> >             'td', { align: 'center', style: 'color: white;' },
> >                 'I was created by createAppend()!'
> >         ]
> >     ]
> > );
> >
> > jQuery
> > $('#exampleCA').append($(
> >     '<table style="width:718px;border:2px inset #336699">'+
> >         '<tr class="exampleRow">'+
> >             '<td style="text-align:center;color:white;">'+
> >                 'I was created by jQuery append'+
> >             '</td>'+
> >         '</tr>'+
> >     '</table>'
> > ));
> >
> > As far as I can tell both of these would do the same thing?
> > They're both as easy as each other, maybe jQuery is even
> > easier as it's plain html. Would the jQuery version be faster
> > also as it could just inject the html into the DOM using
> > something like innerHTML.
>
> Yes indeed, innerHTML is faster than DOM insertion, and you also remove
> the overhead of the code that interprets the element list.
>
> In fact, I wrote the first jQuery DOM plugin, and I don't use my own
> plugin any more!
>
> You can improve the speed even more by using [].join instead of string
> concatenation:
>
> $('#exampleCA').append($( [
>      '<table style="width:718px;border:2px inset #336699">',
>          '<tr class="exampleRow">',
>              '<td style="text-align:center;color:white;">',
>                  'I was created by jQuery append',
>              '</td>',
>          '</tr>',
>      '</table>'
> ].join('') ));
>
> In your simple test case it won't make any difference, but if you are
> stringing together a lot of HTML code, [].join will speed it
> up in most browsers.
>
> -Mike
>
>
> >
>


-- 
/James

Reply via email to