On Aug 20, 12:02 am, Walter Lee Davis <[EMAIL PROTECTED]> wrote:
> On Aug 19, 2008, at 11:46 PM, kangax wrote:
>
> >   $W('foo').wrap('div', { className: 'bar' }); // NodeWrapper around a
> > newly created `div` element with class="bar"
>
> Sorry to barge in the middle here, but could you clarify what 'foo'  
> means here? Is 'foo' the ID of the newly-created div.bar? Or is the  
> existing div#foo now wrapped with a div.bar?

Walter, sorry for the confusion.

$W('foo') returns a wrapper of "id='foo' element".
`wrap` then wraps the original element with <div class="bar"></div>
and returns a wrapper around this newly created element (class=bar).

An analogy with our current way of doing things would be:

$('foo').wrap('div', { className: 'bar' });

You can see how it looks almost identical (or fully identical if we
were to use `$` as a wrapper helper). The only difference is the
internal implementation.

-- kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to