From 492ad3a7b411c0261dfefa3f7fcb84fe65ace600 Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Tue, 5 Nov 2013 11:47:14 -0500 Subject: [PATCH 1/2] Clarify bindAll and events hash `this` binding in FAQ section --- index.html | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index a7d995a3..569cec06 100644 --- a/index.html +++ b/index.html @@ -624,7 +624,7 @@ of data-structuring (models and collections) and user interface (views and URLs) primitives that are generally useful when building web applications with JavaScript. In an ecosystem where overarching, decides-everything-for-you - frameworks are commonplace, and many libraries require your site to be + frameworks are commonplace, and many libraries require your site to be reorganized to suit their look, feel, and default behavior — Backbone should continue to be a tool that gives you the freedom to design the full experience of your web application. @@ -679,11 +679,11 @@
  • In 1.1, Backbone Views no longer have the options argument - attached as this.options automatically. Feel free to continue + attached as this.options automatically. Feel free to continue attaching it if you like.
  • - In 1.1, The Collection methods add, remove, + In 1.1, The Collection methods add, remove, set, push, and shift now return the model (or models) added or removed from the collection.
  • @@ -1015,7 +1015,7 @@ var Library = Backbone.Model.extend({ collection the model belongs to, and is used to help compute the model's url. The model.collection property is normally created automatically when you first add a model to a collection. - Note that the reverse is not true, as passing this option to the constructor + Note that the reverse is not true, as passing this option to the constructor will not automatically add the model to the collection. Useful, sometimes.

    @@ -1774,7 +1774,7 @@ ships.add([

    removecollection.remove(models, [options])
    - Remove a model (or an array of models) from the collection, and returns them. + Remove a model (or an array of models) from the collection, and returns them. Fires a "remove" event, which you can use silent to suppress. The model's index before removal is available to listeners as options.index. @@ -2645,9 +2645,9 @@ ui.Chapter = Backbone.View.extend({ templateview.template([data])
    While templating for a view isn't a function provided directly by Backbone, - it's often a nice convention to define a template function on your + it's often a nice convention to define a template function on your views. In this way, when rendering your view, you have convenient access to - instance data. + instance data. For example, using Underscore templates:

    @@ -3089,13 +3089,13 @@ var model = localBackbone.Model.extend(...);

    Delicious

    - Delicious is a social bookmarking - platform making it easy to save, sort, and store bookmarks from across - the web. Delicious uses Chaplin.js, - Backbone.js and AppCache to build a full-featured MVC web app. - The use of Backbone helped the website and - mobile apps share a - single API service, and the reuse of the model tier made it significantly + Delicious is a social bookmarking + platform making it easy to save, sort, and store bookmarks from across + the web. Delicious uses Chaplin.js, + Backbone.js and AppCache to build a full-featured MVC web app. + The use of Backbone helped the website and + mobile apps share a + single API service, and the reuse of the model tier made it significantly easier to share code during the recent Delicious redesign.

    @@ -3950,9 +3950,13 @@ inbox.messages.fetch({reset: true});

    - When binding callbacks to Backbone events, you can choose to pass an optional - third argument to specify the this that will be used when the - callback is later invoked: + Be aware that `bindAll` comes with its own set of "gotchas", particularly + in older browsers, and its use is generally discouraged in favor of other + scoping techniques. Event handlers designated in your + View's events hash are automatically bound to the current view + instance, while Backbone Events can optionally take a third argument to + specify the this that will be used when the callback is later + invoked:

    @@ -4006,13 +4010,13 @@ ActiveRecord::Base.include_root_in_json = false
         1.1.0Oct. 10, 2013DiffDocs