@ksamdev - If there aren't really any benefits I think I'll stick with
the shorter version. Thanks for your help.

On Aug 27, 4:00 pm, ksamdev <[email protected]> wrote:
> @atwork8
>
> No benefits. The result would be the same except that work is done
> with DOM objects directly if you do things the way I proposed which I
> find very clear and always tend to work with. It is simply conceptual
> difference. Anyway, I guess at the end browser will rearrange DOM tree
> and do the job in background putting all children into new DIV.
> Besides, I guess, it will have to parse new HTML of document.body that
> would take some time. Thus, presumably, It is faster to work with DOM
> Tree.
>
> On Aug 27, 7:36 am, atwork8 <[email protected]> wrote:
>
> > @ksamdev - what are the benefits of doing it that way over what I had
> > originally posted?
>
> > var elBody = $(document.body);
> > elBody.set('html', '<div id="wrapper">' + elBody.get('html') + '</
> > div>');
>
> > On Aug 27, 1:27 pm, ksamdev <[email protected]> wrote:
>
> > > ok. I see your point. Then do something like:
>
> > > var _div = new Element( 'div');
> > > var _body = $( document.body);
> > > _body.getChildren().each( function( _item) { _div.grab( _item); });
> > > _body.adopt( _div);
>
> > > On Aug 27, 7:22 am, atwork8 <[email protected]> wrote:
>
> > > > @ksamdev - Could you please read the problem. The results are
> > > > completely different. The solution I've provided generates this:
>
> > > > <body><div id="wrapper">body's html</div></body>
>
> > > > Fabio's generates:
>
> > > > <div id="wrapper"><body>body's html</body></div>
>
>

Reply via email to