Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for #166

  • Loading branch information...
commit e5082c7924df8213fe9628e23b3ca4ce8c6a12ef 1 parent 5b37828
@addyosmani authored
View
BIN  backbone-fundamentals.epub
Binary file not shown
View
2  backbone-fundamentals.rtf
@@ -694,7 +694,7 @@ myPhoto.setTitle('Fishing at sea');\line
var myPhoto = new Photo();\line
myPhoto.set(\{ title: "On the beach" \});\line
//logs Remember to set a source for your image!\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 {\b Note}: Backbone passes the {\f1 attributes} object by shallow copy to the {\f1 validate} function using the Underscore {\f1 _.extend} method. This means that it is not possible to change any {\f1 Number}, {\f1 String} or {\f1 Boolean} attribute by reference in the way that one might expect a JavaScript object to behave. As shallow copy doesn\u8217't copy objects by implicitly copying them, but rather, by reference, one ca change the attributes on those objects.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 {\b Note}: Backbone passes the {\f1 attributes} object by shallow copy to the {\f1 validate} function using the Underscore {\f1 _.extend} method. This means that it is not possible to change any Number, String or Boolean attribute but it {\i is} possible to change attributes of objects because they are passed by reference. As shallow copy doesn\u8217't copy objects by implicitly copying them, but rather, by reference, one can change the attributes on those objects.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 An example of this (by @fivetanley) is available {\field{\*\fldinst{HYPERLINK "http://jsfiddle.net/2NdDY/7/"}}{\fldrslt{\ul
here
}}}
View
2  index.html
@@ -613,7 +613,7 @@ <h4 id="model.set">Model.set()</h4>
<span class="kw">var</span> myPhoto = <span class="kw">new</span> Photo();
<span class="kw">myPhoto</span>.<span class="fu">set</span>({ <span class="dt">title</span>: <span class="st">&quot;On the beach&quot;</span> });
<span class="co">//logs Remember to set a source for your image!</span></code></pre>
-<p><strong>Note</strong>: Backbone passes the <code>attributes</code> object by shallow copy to the <code>validate</code> function using the Underscore <code>_.extend</code> method. This means that it is not possible to change any <code>Number</code>, <code>String</code> or <code>Boolean</code> attribute by reference in the way that one might expect a JavaScript object to behave. As shallow copy doesn't copy objects by implicitly copying them, but rather, by reference, one ca change the attributes on those objects.</p>
+<p><strong>Note</strong>: Backbone passes the <code>attributes</code> object by shallow copy to the <code>validate</code> function using the Underscore <code>_.extend</code> method. This means that it is not possible to change any Number, String or Boolean attribute but it <em>is</em> possible to change attributes of objects because they are passed by reference. As shallow copy doesn't copy objects by implicitly copying them, but rather, by reference, one can change the attributes on those objects.</p>
<p>An example of this (by @fivetanley) is available <a href="http://jsfiddle.net/2NdDY/7/">here</a>.</p>
<h2 id="views-1"><a name="thebasics-views" id="thebasics-views">Views</a></h2>
<p>Views in Backbone don't contain the markup for your application, but rather they are there to support models by defining the logic for how they should be represented to the user. This is usually achieved using JavaScript templating (e.g. Mustache, jQuery-tmpl, etc.). A view's <code>render()</code> function can be bound to a model's <code>change()</code> event, allowing the view to always be up to date without requiring a full page refresh.</p>
View
2  index.md
@@ -808,7 +808,7 @@ myPhoto.set({ title: "On the beach" });
//logs Remember to set a source for your image!
```
-**Note**: Backbone passes the `attributes` object by shallow copy to the `validate` function using the Underscore `_.extend` method. This means that it is not possible to change any `Number`, `String` or `Boolean` attribute by reference in the way that one might expect a JavaScript object to behave. As shallow copy doesn't copy objects by implicitly copying them, but rather, by reference, one ca change the attributes on those objects.
+**Note**: Backbone passes the `attributes` object by shallow copy to the `validate` function using the Underscore `_.extend` method. This means that it is not possible to change any Number, String or Boolean attribute but it *is* possible to change attributes of objects because they are passed by reference. As shallow copy doesn't copy objects by implicitly copying them, but rather, by reference, one can change the attributes on those objects.
An example of this (by @fivetanley) is available [here](http://jsfiddle.net/2NdDY/7/).
Please sign in to comment.
Something went wrong with that request. Please try again.