mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 17:27:59 -05:00
Replace references to jQuery's 'bind' with 'on'
This commit is contained in:
@@ -2,5 +2,5 @@ Account = (customer, cart) ->
|
||||
@customer = customer
|
||||
@cart = cart
|
||||
|
||||
$('.shopping_cart').bind 'click', (event) =>
|
||||
$('.shopping_cart').on 'click', (event) =>
|
||||
@customer.purchase @cart
|
||||
@@ -806,7 +806,7 @@ Expressions
|
||||
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
|
||||
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.
|
||||
</p>
|
||||
<%= codeFor('fat_arrow') %>
|
||||
|
||||
@@ -4,7 +4,7 @@ var Account;
|
||||
Account = function(customer, cart) {
|
||||
this.customer = customer;
|
||||
this.cart = cart;
|
||||
return $('.shopping_cart').bind('click', (function(_this) {
|
||||
return $('.shopping_cart').on('click', (function(_this) {
|
||||
return function(event) {
|
||||
return _this.customer.purchase(_this.cart);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user