From 942e350551f4a7c7cd9254e7cc9430a45e7cd7ed Mon Sep 17 00:00:00 2001 From: xMartin Date: Sun, 4 Nov 2012 22:53:09 +0100 Subject: [PATCH 1/5] grammar fix --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index a0df02eb..c1110da6 100644 --- a/index.md +++ b/index.md @@ -3454,7 +3454,7 @@ This tackles a few specific design decisions: * The order in which you append the sub-elements matters * The OuterView doesn't contain the HTML elements to be set in the InnerView(s), meaning that we can still specify tagName in the InnerView -* render() is called after the InnerView element has been placed into the DOM. This is useful if your InnerViews render() method is sizing itself on the page based on the dimensions of another element. This is a common use case. +* render() is called after the InnerView element has been placed into the DOM. This is useful if your InnerView's render() method is sizing itself on the page based on the dimensions of another element. This is a common use case. A second potential solution is this, which may appear cleaner but in reality has a tendency to affect performance: From 9a1161d3b33d8950b428a8cf64027159d9dc59f7 Mon Sep 17 00:00:00 2001 From: xMartin Date: Sun, 4 Nov 2012 22:54:44 +0100 Subject: [PATCH 2/5] grammar fix --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index c1110da6..44bac05f 100644 --- a/index.md +++ b/index.md @@ -962,7 +962,7 @@ var todo2 = todos.get(2); console.log(todo2 === myTodo); ``` -Internally `Backbone.Collection` sets array of models enumerated by their `id` property, if model instances happen to have one. Once `collection.get(id)` is called this array is checked for existence of the model instance with the corresponding `id`. +Internally `Backbone.Collection` sets an array of models enumerated by their `id` property, if model instances happen to have one. Once `collection.get(id)` is called this array is checked for existence of the model instance with the corresponding `id`. Sometimes you may also want to get a model based on its client id. The client id is a property that Backbone automatically assigns models that have not yet been saved. You can get a model's client id from its `.cid` property. From 1cbeea20162dc6110de6a8c0fea9d107d5287f3c Mon Sep 17 00:00:00 2001 From: xMartin Date: Sun, 4 Nov 2012 22:55:19 +0100 Subject: [PATCH 3/5] remove word being twice in a sentence --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 44bac05f..7a5a8c93 100644 --- a/index.md +++ b/index.md @@ -636,7 +636,7 @@ console.log(todo2.get('title')); // Retrieved with models get() method. console.log(todo2.get('completed')); // false ``` -Alternatively, if you wish to directly access all of the attributes in a model's instance directly, you can achieve this as follows: +Alternatively, if you wish to access all of the attributes in a model's instance directly, you can achieve this as follows: ```javascript var Todo = Backbone.Model.extend({ From 5d74371d824d1c52772ea7230fbd49891bf85ee4 Mon Sep 17 00:00:00 2001 From: xMartin Date: Sun, 4 Nov 2012 22:56:11 +0100 Subject: [PATCH 4/5] remove repetitions in text about Model.attributes --- index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.md b/index.md index 7a5a8c93..8f69caac 100644 --- a/index.md +++ b/index.md @@ -663,8 +663,7 @@ console.log(myTodo.attributes.title); It is best practice to use `Model.set()` or direct instantiation to set the values of a model's attributes. -Accessing `Model.attributes` directly is generally discouraged. Instead, should you need to read or clone data, `Model.toJSON()` is recommended for this purpose. If you would like to access or copy a model's attributes for purposes such as JSON stringification (e.g. for serialization prior to being passed to a view), this can be achieved using Model.toJSON(). Remember that this will return an object and JSON.stringify() should be used to get a string representation of the data: - +Accessing `Model.attributes` directly is generally discouraged. If you need to read or clone data for purposes such as JSON stringification (e.g. for serialization prior to being passed to a view), this can be achieved using Model.toJSON(). Remember that this will return an object and JSON.stringify() should be used to get a string representation of the data: ```javascript var Todo = Backbone.Model.extend({ From e8cce4c3757bc2b602a41ba33118449373f2a8cd Mon Sep 17 00:00:00 2001 From: xMartin Date: Sun, 4 Nov 2012 22:59:42 +0100 Subject: [PATCH 5/5] use quotes for technical term "state" only once in a paragraph --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 8f69caac..58295537 100644 --- a/index.md +++ b/index.md @@ -216,7 +216,7 @@ Here's how we might group Todo models into a Backbone Collection: console.log(todos.models); ``` -If you read older texts on MVC, you may come across a description of models as also managing application 'state'. In JavaScript applications "state" has a specific meaning, typically referring to the current "state" of a view or sub-view on a user's screen at a fixed time. State is a topic which is regularly discussed when looking at Single-page applications, where the concept of state needs to be simulated. +If you read older texts on MVC, you may come across a description of models as also managing application "state". In JavaScript applications state has a specific meaning, typically referring to the current state of a view or sub-view on a user's screen at a fixed time. State is a topic which is regularly discussed when looking at Single-page applications, where the concept of state needs to be simulated. ### Views