@@ -44,8 +44,8 @@ var manualUppercase = function (s) {
44
44
45
45
46
46
// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
47
- // locale, for this reason we need to detect this case and redefine lowercase/uppercase methods with
48
- // correct but slower alternatives.
47
+ // locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
48
+ // with correct but slower alternatives.
49
49
if ( 'i' !== 'I' . toLowerCase ( ) ) {
50
50
lowercase = manualLowercase ;
51
51
uppercase = manualUppercase ;
@@ -118,10 +118,11 @@ var _undefined = undefined,
118
118
* @function
119
119
*
120
120
* @description
121
- * Invokes the `iterator` function once for each item in `obj` collection. The collection can either
122
- * be an object or an array. The `iterator` function is invoked with `iterator(value, key)`, where
123
- * `value` is the value of an object property or an array element and `key` is the object property
124
- * key or array element index. Optionally, `context` can be specified for the iterator function.
121
+ * Invokes the `iterator` function once for each item in `obj` collection. The collection can
122
+ * either be an object or an array. The `iterator` function is invoked with `iterator(value, key)`,
123
+ * where `value` is the value of an object property or an array element and `key` is the object
124
+ * property key or array element index. Optionally, `context` can be specified for the iterator
125
+ * function.
125
126
*
126
127
* Note: this function was previously known as `angular.foreach`.
127
128
*
@@ -222,8 +223,8 @@ function nextUid() {
222
223
* @function
223
224
*
224
225
* @description
225
- * Extends the destination object `dst` by copying all of the properties from the `src` object(s) to
226
- * `dst`. You can specify multiple `src` objects.
226
+ * Extends the destination object `dst` by copying all of the properties from the `src` object(s)
227
+ * to `dst`. You can specify multiple `src` objects.
227
228
*
228
229
* @param {Object } dst The destination object.
229
230
* @param {...Object } src The source object(s).
@@ -428,9 +429,13 @@ function isWindow(obj) {
428
429
return obj && obj . document && obj . location && obj . alert && obj . setInterval ;
429
430
}
430
431
431
- function isBoolean ( value ) { return typeof value == $boolean ; }
432
+ function isBoolean ( value ) { return typeof value == $boolean ; }
432
433
function isTextNode ( node ) { return nodeName_ ( node ) == '#text' ; }
433
- function trim ( value ) { return isString ( value ) ? value . replace ( / ^ \s * / , '' ) . replace ( / \s * $ / , '' ) : value ; }
434
+
435
+ function trim ( value ) {
436
+ return isString ( value ) ? value . replace ( / ^ \s * / , '' ) . replace ( / \s * $ / , '' ) : value ;
437
+ }
438
+
434
439
function isElement ( node ) {
435
440
return node &&
436
441
( node . nodeName // we are a direct element
@@ -451,10 +456,12 @@ function makeMap(str){
451
456
452
457
453
458
/**
454
- * HTML class which is the only class which can be used in ng:bind to inline HTML for security reasons.
459
+ * HTML class which is the only class which can be used in ng:bind to inline HTML for security
460
+ * reasons.
461
+ *
455
462
* @constructor
456
463
* @param html raw (unsafe) html
457
- * @param {string= } option if set to 'usafe' then get method will return raw (unsafe/unsanitized) html
464
+ * @param {string= } option If set to 'usafe', get method will return raw (unsafe/unsanitized) html
458
465
*/
459
466
function HTML ( html , option ) {
460
467
this . html = html ;
@@ -470,7 +477,8 @@ function HTML(html, option) {
470
477
if ( msie < 9 ) {
471
478
nodeName_ = function ( element ) {
472
479
element = element . nodeName ? element : element [ 0 ] ;
473
- return ( element . scopeName && element . scopeName != 'HTML' ) ? uppercase ( element . scopeName + ':' + element . nodeName ) : element . nodeName ;
480
+ return ( element . scopeName && element . scopeName != 'HTML' )
481
+ ? uppercase ( element . scopeName + ':' + element . nodeName ) : element . nodeName ;
474
482
} ;
475
483
} else {
476
484
nodeName_ = function ( element ) {
@@ -500,26 +508,35 @@ function map(obj, iterator, context) {
500
508
* @function
501
509
*
502
510
* @description
503
- * Determines the number of elements in an array, number of properties of an object or string
504
- * length.
511
+ * Determines the number of elements in an array, the number of properties an object has, or
512
+ * the length of a string .
505
513
*
506
- * Note: this function is used to augment the Object type in angular expressions. See
507
- * {@link angular.Object} for more info .
514
+ * Note: This function is used to augment the Object type in Angular expressions. See
515
+ * {@link angular.Object} for more information about Angular arrays .
508
516
*
509
- * @param {Object|Array|string } obj Object, array or string to inspect.
517
+ * @param {Object|Array|string } obj Object, array, or string to inspect.
510
518
* @param {boolean } [ownPropsOnly=false] Count only "own" properties in an object
511
519
* @returns {number } The size of `obj` or `0` if `obj` is neither an object or an array.
512
520
*
513
521
* @example
514
522
* <doc:example>
515
523
* <doc:source>
516
- * Number of items in array: {{ [1,2].$size() }}<br/>
517
- * Number of items in object: {{ {a:1, b:2, c:3}.$size() }}<br/>
524
+ * <script>
525
+ * function SizeCtrl() {
526
+ * this.fooStringLength = angular.Object.size('foo');
527
+ * }
528
+ * </script>
529
+ * <div ng:controller="SizeCtrl">
530
+ * Number of items in array: {{ [1,2].$size() }}<br/>
531
+ * Number of items in object: {{ {a:1, b:2, c:3}.$size() }}<br/>
532
+ * String length: {{fooStringLength}}
533
+ * </div>
518
534
* </doc:source>
519
535
* <doc:scenario>
520
536
* it('should print correct sizes for an array and an object', function() {
521
537
* expect(binding('[1,2].$size()')).toBe('2');
522
538
* expect(binding('{a:1, b:2, c:3}.$size()')).toBe('3');
539
+ * expect(binding('fooStringLength')).toBe('3');
523
540
* });
524
541
* </doc:scenario>
525
542
* </doc:example>
@@ -581,24 +598,21 @@ function isLeafNode (node) {
581
598
* @function
582
599
*
583
600
* @description
584
- * Creates a deep copy of `source`.
601
+ * Creates a deep copy of `source`, which should be an object or an array .
585
602
*
586
- * If `source` is an object or an array, all of its members will be copied into the `destination`
587
- * object.
603
+ * * If no destination is supplied, a copy of the object or array is created.
604
+ * * If a destination is provided, all of its elements (for array) or properties (for objects)
605
+ * are deleted and then all elements/properties from the source are copied to it.
606
+ * * If `source` is not an object or array, `source` is returned.
588
607
*
589
- * If `destination` is not provided and `source` is an object or an array, a copy is created &
590
- * returned, otherwise the `source` is returned .
608
+ * Note: this function is used to augment the Object type in Angular expressions. See
609
+ * { @link angular.Array} for more information about Angular arrays .
591
610
*
592
- * If `destination` is provided, all of its properties will be deleted.
593
- *
594
- * Note: this function is used to augment the Object type in angular expressions. See
595
- * {@link angular.Object} for more info.
596
- *
597
- * @param {* } source The source to be used to make a copy.
598
- * Can be any type including primitives, `null` and `undefined`.
599
- * @param {(Object|Array)= } destination Optional destination into which the source is copied. If
611
+ * @param {* } source The source that will be used to make a copy.
612
+ * Can be any type, including primitives, `null`, and `undefined`.
613
+ * @param {(Object|Array)= } destination Destination into which the source is copied. If
600
614
* provided, must be of the same type as `source`.
601
- * @returns {* } The copy or updated `destination` if `destination` was specified.
615
+ * @returns {* } The copy or updated `destination`, if `destination` was specified.
602
616
*
603
617
* @example
604
618
* <doc:example>
@@ -660,7 +674,6 @@ function copy(source, destination){
660
674
}
661
675
662
676
/**
663
- * @workInProgress
664
677
* @ngdoc function
665
678
* @name angular.equals
666
679
* @function
@@ -675,16 +688,19 @@ function copy(source, destination){
675
688
* @function
676
689
*
677
690
* @description
678
- * Determines if two objects or value are equivalent.
691
+ * Determines if two objects or two values are equivalent. Supports value types, arrays and
692
+ * objects.
679
693
*
680
- * To be equivalent, they must pass `===` comparison or be of the same type and have all their
681
- * properties pass `===` comparison. During property comparision properties of `function` type and
682
- * properties with name starting with `$` are ignored.
694
+ * Two objects or values are considered equivalent if at least one of the following is true:
683
695
*
684
- * Supports values types, arrays and objects.
696
+ * * Both objects or values pass `===` comparison.
697
+ * * Both objects or values are of the same type and all of their properties pass `===` comparison.
685
698
*
686
- * Note: this function is used to augment the Object type in angular expressions. See
687
- * {@link angular.Object} for more info.
699
+ * During a property comparision, properties of `function` type and properties with names
700
+ * that begin with `$` are ignored.
701
+ *
702
+ * Note: This function is used to augment the Object type in Angular expressions. See
703
+ * {@link angular.Array} for more information about Angular arrays.
688
704
*
689
705
* @param {* } o1 Object or value to compare.
690
706
* @param {* } o2 Object or value to compare.
@@ -732,7 +748,9 @@ function equals(o1, o2) {
732
748
} else {
733
749
keySet = { } ;
734
750
for ( key in o1 ) {
735
- if ( key . charAt ( 0 ) !== '$' && ! isFunction ( o1 [ key ] ) && ! equals ( o1 [ key ] , o2 [ key ] ) ) return false ;
751
+ if ( key . charAt ( 0 ) !== '$' && ! isFunction ( o1 [ key ] ) && ! equals ( o1 [ key ] , o2 [ key ] ) ) {
752
+ return false ;
753
+ }
736
754
keySet [ key ] = true ;
737
755
}
738
756
for ( key in o2 ) {
@@ -802,7 +820,9 @@ function sliceArgs(args, startIndex) {
802
820
* @function
803
821
*
804
822
* @description
805
- * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for `fn`).
823
+ * Returns a function which calls function `fn` bound to `self`
824
+ * (`self` becomes the `this` for `fn`).
825
+ *
806
826
* Optional `args` can be supplied which are prebound to the function, also known as
807
827
* [function currying](http://en.wikipedia.org/wiki/Currying).
808
828
*
@@ -826,7 +846,8 @@ function bind(self, fn) {
826
846
: fn . call ( self ) ;
827
847
} ;
828
848
} else {
829
- // in IE, native methods are not functions and so they can not be bound (but they don't need to be)
849
+ // in IE, native methods are not functions and so they can not be bound
850
+ // (but they don't need to be)
830
851
return fn ;
831
852
}
832
853
}
@@ -928,7 +949,6 @@ function encodeUriQuery(val, pctEncodeSpaces) {
928
949
929
950
930
951
/**
931
- * @workInProgress
932
952
* @ngdoc directive
933
953
* @name angular.directive.ng:autobind
934
954
* @element script
@@ -938,14 +958,17 @@ function encodeUriQuery(val, pctEncodeSpaces) {
938
958
* @TODO rename to ng:autobind to ng:autoboot
939
959
*
940
960
* @description
961
+ * Technically, ng:autobind is not a directive; it is an Angular bootstrap parameter that can act
962
+ * as a directive. It must exist in the script used to boot Angular and can be used only one time.
963
+ * For details on bootstrapping Angular, see {@link guide/dev_guide.bootstrap Initializing Angular}
964
+ * in the Angular Developer Guide.
941
965
*
942
- * `ng:autobind` with no parameters tells angular to compile and manage the whole page.
966
+ * `ng:autobind` with no parameters tells Angular to compile and manage the whole page.
943
967
*
944
- * `ng:autobind="[root element ID]"` tells angular to compile and manage part of the docucment ,
968
+ * `ng:autobind="[root element ID]"` tells Angular to compile and manage part of the document ,
945
969
* starting at "root element ID".
946
970
*
947
- * For details on bootstrapping angular, see {@link guide/dev_guide.bootstrap Initializing Angular}
948
- * in the Angular Developer Guide.
971
+
949
972
*/
950
973
function angularInit ( config , document ) {
951
974
var autobind = config . autobind ;
0 commit comments