(Map|Set|WeakMap)#set() returns `this` ?

Rick Waldron waldron.rick at gmail.com
Tue Dec 4 12:03:37 PST 2012

On Tue, Dec 4, 2012 at 2:46 PM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> for develoeprs I meant jQuery users too, being one of th emost popular API
> out there.
> What I meant with jQuery#add method is that last thing added is the one
> returned, it does nto return the initial object, it returns the new result
> out of a merge but this is not the initial this, this is a new thing with
> latest added thing in.

That is exactly what I described—the case for returning a fresh jQuery
object exists to support end() (http://api.jquery.com/end/) which allows
you to chain operations (eg. filter->apply css or something) and restore
the original jQuery object (matching set of elements) by keeping a
reference to that object stored as a property of the new jQuery object.
This mechanism is irrelevant in the comparison of Set API semantics.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121204/29ba633e/attachment.html>

More information about the es-discuss mailing list