diff --git a/index.html b/index.html index a7d995a3..200e7cf2 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.

    @@ -3941,18 +3941,30 @@ inbox.messages.fetch({reset: true}); Binding "this"
    Perhaps the single most common JavaScript "gotcha" is the fact that when - you pass a function as a callback, its value for this is lost. With - Backbone, when dealing with events and callbacks, - you'll often find it useful to rely on - _.bind and - _.bindAll - from Underscore.js. -

    + you pass a function as a callback, its value for this is lost. + When dealing with events and callbacks in Backbone, + you'll often find it useful to rely on listenTo + or the optional context argument that many of Underscore + and Backbone's methods use to specify the this + that will be used when the callback is later invoked. (See + _.each, + _.map, and + object.on, to name a few). + View events are automatically bound to + the view's context for you. +

    - 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: + You may also find it helpful to use + _.bind and + _.bindAll + from Underscore.js. Be aware, however, that due to an imperfect shim in older + browsers, the bound function's arity (that is, its length + property) is not preserved when a native bind is not present. + This is known to cause problems with constructor and collection + comparator + functions bound from within the object instance and this pattern is + highly discouraged for this reason.

    @@ -3963,6 +3975,8 @@ var MessageList = Backbone.View.extend({
         messages.on("reset", this.render, this);
         messages.on("add", this.addMessage, this);
         messages.on("remove", this.removeMessage, this);
    +
    +    messsages.each(this.addMessage, this);
       }
     
     });
    @@ -4006,13 +4020,13 @@ ActiveRecord::Base.include_root_in_json = false
         1.1.0Oct. 10, 2013DiffDocs