On Friday, March 30, 2012 at 6:03 AM, Marius Gundersen wrote:
> > Indeed lexical |this| means you can't pass a wrong-this even via .call or
> > .apply. Thanks,
>
> Isn't this a bad idea? Take for example the very common jQuery callback
> method, which would look like this:
>
> $("img").on("click", e => $(this).hide());
>
> jQuery (and many other frameworks) do a lot of things with |this| behind the
> scenes, where it would be very nice to have |this| be set by the framework.
jQuery provides the same |this| value that you'd get using addEventListener, so
this issue would exist in the DOM as well.
More pointedly, lexical |this| prevents modifying |this| via apply and call
I had hoped for thin arrow to lighten the keystroke load here.
Rick
> Or is the consensus that the current way of doing this is not good, and
> should be discurraged?
>
> Marius Gundersen
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss