Skip to content

Commit f86395a

Browse files
sdornanpetebacondarwin
authored andcommitted
docs(scope): clean up grammar and improve clarity
Some typos fixed and grammar improved: - withing -> within - life-cycle -> life cycle - extraneous spaces - grammar mistakes - missing commas - reworded unclear statements Closes angular#3920
1 parent c0db11c commit f86395a

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

src/ng/rootScope.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
*
5757
* Every application has a single root {@link ng.$rootScope.Scope scope}.
5858
* All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
59-
* event processing life-cycle. See {@link guide/scope developer guide on scopes}.
59+
* event processing life cycle. See {@link guide/scope developer guide on scopes}.
6060
*/
6161
function $RootScopeProvider(){
6262
var TTL = 10;
@@ -152,9 +152,9 @@ function $RootScopeProvider(){
152152
* the scope and its child scopes to be permanently detached from the parent and thus stop
153153
* participating in model change detection and listener notification by invoking.
154154
*
155-
* @param {boolean} isolate if true then the scope does not prototypically inherit from the
155+
* @param {boolean} isolate If true, then the scope does not prototypically inherit from the
156156
* parent scope. The scope is isolated, as it can not see parent scope properties.
157-
* When creating widgets it is useful for the widget to not accidentally read parent
157+
* When creating widgets, it is useful for the widget to not accidentally read parent
158158
* state.
159159
*
160160
* @returns {Object} The newly created child scope.
@@ -167,12 +167,12 @@ function $RootScopeProvider(){
167167
if (isolate) {
168168
child = new Scope();
169169
child.$root = this.$root;
170-
// ensure that there is just one async queue per $rootScope and it's children
170+
// ensure that there is just one async queue per $rootScope and its children
171171
child.$$asyncQueue = this.$$asyncQueue;
172172
child.$$postDigestQueue = this.$$postDigestQueue;
173173
} else {
174174
Child = function() {}; // should be anonymous; This is so that when the minifier munges
175-
// the name it does not become random set of chars. These will then show up as class
175+
// the name it does not become random set of chars. This will then show up as class
176176
// name in the debugger.
177177
Child.prototype = this;
178178
child = new Child();
@@ -202,7 +202,7 @@ function $RootScopeProvider(){
202202
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
203203
*
204204
* - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest $digest()} and
205-
* should return the value which will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()}
205+
* should return the value that will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()}
206206
* reruns when it detects changes the `watchExpression` can execute multiple times per
207207
* {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
208208
* - The `listener` is called only when the value from the current `watchExpression` and the
@@ -313,13 +313,13 @@ function $RootScopeProvider(){
313313
*
314314
* @description
315315
* Shallow watches the properties of an object and fires whenever any of the properties change
316-
* (for arrays this implies watching the array items, for object maps this implies watching the properties).
317-
* If a change is detected the `listener` callback is fired.
316+
* (for arrays, this implies watching the array items; for object maps, this implies watching the properties).
317+
* If a change is detected, the `listener` callback is fired.
318318
*
319319
* - The `obj` collection is observed via standard $watch operation and is examined on every call to $digest() to
320320
* see if any items have been added, removed, or moved.
321-
* - The `listener` is called whenever anything within the `obj` has changed. Examples include adding new items
322-
* into the object or array, removing and moving items around.
321+
* - The `listener` is called whenever anything within the `obj` has changed. Examples include adding, removing,
322+
* and moving items belonging to an object or array.
323323
*
324324
*
325325
* # Example
@@ -356,8 +356,8 @@ function $RootScopeProvider(){
356356
* `oldCollection` object is a copy of the former collection data.
357357
* The `scope` refers to the current scope.
358358
*
359-
* @returns {function()} Returns a de-registration function for this listener. When the de-registration function is executed
360-
* then the internal watch operation is terminated.
359+
* @returns {function()} Returns a de-registration function for this listener. When the de-registration function
360+
* is executed, the internal watch operation is terminated.
361361
*/
362362
$watchCollection: function(obj, listener) {
363363
var self = this;
@@ -458,18 +458,17 @@ function $RootScopeProvider(){
458458
* firing. This means that it is possible to get into an infinite loop. This function will throw
459459
* `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 10.
460460
*
461-
* Usually you don't call `$digest()` directly in
461+
* Usually, you don't call `$digest()` directly in
462462
* {@link ng.directive:ngController controllers} or in
463463
* {@link ng.$compileProvider#directive directives}.
464-
* Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
465-
* {@link ng.$compileProvider#directive directives}) will force a `$digest()`.
464+
* Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a
465+
* {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.
466466
*
467467
* If you want to be notified whenever `$digest()` is called,
468-
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
468+
* you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()}
469469
* with no `listener`.
470470
*
471-
* You may have a need to call `$digest()` from within unit-tests, to simulate the scope
472-
* life-cycle.
471+
* In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
473472
*
474473
* # Example
475474
* <pre>
@@ -610,8 +609,8 @@ function $RootScopeProvider(){
610609
* {@link ng.directive:ngRepeat ngRepeat} for managing the
611610
* unrolling of the loop.
612611
*
613-
* Just before a scope is destroyed a `$destroy` event is broadcasted on this scope.
614-
* Application code can register a `$destroy` event handler that will give it chance to
612+
* Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
613+
* Application code can register a `$destroy` event handler that will give it a chance to
615614
* perform any necessary cleanup.
616615
*
617616
* Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
@@ -643,7 +642,7 @@ function $RootScopeProvider(){
643642
* @function
644643
*
645644
* @description
646-
* Executes the `expression` on the current scope returning the result. Any exceptions in the
645+
* Executes the `expression` on the current scope and returns the result. Any exceptions in the
647646
* expression are propagated (uncaught). This is useful when evaluating Angular expressions.
648647
*
649648
* # Example
@@ -678,19 +677,19 @@ function $RootScopeProvider(){
678677
*
679678
* The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
680679
*
681-
* - it will execute after the function that schedule the evaluation is done running (preferably before DOM rendering).
680+
* - it will execute after the function that scheduled the evaluation (preferably before DOM rendering).
682681
* - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after `expression` execution.
683682
*
684683
* Any exceptions from the execution of the expression are forwarded to the
685684
* {@link ng.$exceptionHandler $exceptionHandler} service.
686685
*
687-
* __Note:__ if this function is called outside of `$digest` cycle, a new $digest cycle will be scheduled.
688-
* It is however encouraged to always call code that changes the model from withing an `$apply` call.
686+
* __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle will be scheduled.
687+
* However, it is encouraged to always call code that changes the model from within an `$apply` call.
689688
* That includes code evaluated via `$evalAsync`.
690689
*
691690
* @param {(string|function())=} expression An angular expression to be executed.
692691
*
693-
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
692+
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
694693
* - `function(scope)`: execute the function with the current `scope` parameter.
695694
*
696695
*/
@@ -721,7 +720,7 @@ function $RootScopeProvider(){
721720
* @description
722721
* `$apply()` is used to execute an expression in angular from outside of the angular framework.
723722
* (For example from browser DOM events, setTimeout, XHR or third party libraries).
724-
* Because we are calling into the angular framework we need to perform proper scope life-cycle
723+
* Because we are calling into the angular framework we need to perform proper scope life cycle
725724
* of {@link ng.$exceptionHandler exception handling},
726725
* {@link ng.$rootScope.Scope#$digest executing watches}.
727726
*
@@ -790,7 +789,7 @@ function $RootScopeProvider(){
790789
*
791790
* - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or `$broadcast`-ed.
792791
* - `currentScope` - `{Scope}`: the current scope which is handling the event.
793-
* - `name` - `{string}`: Name of the event.
792+
* - `name` - `{string}`: name of the event.
794793
* - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel further event
795794
* propagation (available only for events that were `$emit`-ed).
796795
* - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
@@ -833,7 +832,7 @@ function $RootScopeProvider(){
833832
*
834833
* @param {string} name Event name to emit.
835834
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
836-
* @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
835+
* @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
837836
*/
838837
$emit: function(name, args) {
839838
var empty = [],

0 commit comments

Comments
 (0)