nice one.

On Thu, Aug 27, 2009 at 9:13 AM, Steve Onnis <[email protected]> wrote:

>
> One would ask the question "Why don’t you just output the wrapper div in
> your html?"
>
> -----Original Message-----
> From: ksamdev [mailto:[email protected]]
> Sent: Friday, 28 August 2009 1:00 AM
> To: MooTools Users
> Subject: [Moo] Re: wrap element's html
>
>
> @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