1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Merge pull request #3871 from jcrben/doc_tweak

Replace references to jQuery's 'bind' with 'on'
This commit is contained in:
Jeremy Ashkenas 2015-02-20 17:16:32 -05:00
commit 8f5c77c3ce
3 changed files with 3 additions and 3 deletions

View file

@ -2,5 +2,5 @@ Account = (customer, cart) ->
@customer = customer @customer = customer
@cart = cart @cart = cart
$('.shopping_cart').bind 'click', (event) => $('.shopping_cart').on 'click', (event) =>
@customer.purchase @cart @customer.purchase @cart

View file

@ -806,7 +806,7 @@ Expressions
it to the current value of <tt>this</tt>, right on the spot. This is helpful it to the current value of <tt>this</tt>, right on the spot. This is helpful
when using callback-based libraries like Prototype or jQuery, for creating when using callback-based libraries like Prototype or jQuery, for creating
iterator functions to pass to <tt>each</tt>, or event-handler functions iterator functions to pass to <tt>each</tt>, or event-handler functions
to use with <tt>bind</tt>. Functions created with the fat arrow are able to access to use with <tt>on</tt>. Functions created with the fat arrow are able to access
properties of the <tt>this</tt> where they're defined. properties of the <tt>this</tt> where they're defined.
</p> </p>
<%= codeFor('fat_arrow') %> <%= codeFor('fat_arrow') %>

View file

@ -4,7 +4,7 @@ var Account;
Account = function(customer, cart) { Account = function(customer, cart) {
this.customer = customer; this.customer = customer;
this.cart = cart; this.cart = cart;
return $('.shopping_cart').bind('click', (function(_this) { return $('.shopping_cart').on('click', (function(_this) {
return function(event) { return function(event) {
return _this.customer.purchase(_this.cart); return _this.customer.purchase(_this.cart);
}; };