rails-angularjs 1.4.0.pre.rc.1 → 1.4.0.pre.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rails-angularjs/version.rb +1 -1
  3. data/vendor/assets/javascripts/angular-animate.js +247 -159
  4. data/vendor/assets/javascripts/angular-animate.min.js +45 -44
  5. data/vendor/assets/javascripts/angular-animate.min.js.map +3 -3
  6. data/vendor/assets/javascripts/angular-aria.js +1 -1
  7. data/vendor/assets/javascripts/angular-aria.min.js +1 -1
  8. data/vendor/assets/javascripts/angular-cookies.js +1 -1
  9. data/vendor/assets/javascripts/angular-cookies.min.js +1 -1
  10. data/vendor/assets/javascripts/angular-loader.js +2 -2
  11. data/vendor/assets/javascripts/angular-loader.min.js +2 -2
  12. data/vendor/assets/javascripts/angular-message-format.js +1 -1
  13. data/vendor/assets/javascripts/angular-message-format.min.js +1 -1
  14. data/vendor/assets/javascripts/angular-messages.js +1 -1
  15. data/vendor/assets/javascripts/angular-messages.min.js +1 -1
  16. data/vendor/assets/javascripts/angular-mocks.js +1 -1
  17. data/vendor/assets/javascripts/angular-resource.js +3 -3
  18. data/vendor/assets/javascripts/angular-resource.min.js +8 -8
  19. data/vendor/assets/javascripts/angular-resource.min.js.map +1 -1
  20. data/vendor/assets/javascripts/angular-route.js +1 -1
  21. data/vendor/assets/javascripts/angular-route.min.js +1 -1
  22. data/vendor/assets/javascripts/angular-sanitize.js +1 -1
  23. data/vendor/assets/javascripts/angular-sanitize.min.js +1 -1
  24. data/vendor/assets/javascripts/angular-scenario.js +316 -143
  25. data/vendor/assets/javascripts/angular-touch.js +12 -10
  26. data/vendor/assets/javascripts/angular-touch.min.js +8 -8
  27. data/vendor/assets/javascripts/angular-touch.min.js.map +2 -2
  28. data/vendor/assets/javascripts/angular.js +316 -143
  29. data/vendor/assets/javascripts/angular.min.js +267 -265
  30. data/vendor/assets/javascripts/angular.min.js.map +3 -3
  31. metadata +2 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.4.0-rc.1
2
+ * @license AngularJS v1.4.0-rc.2
3
3
  * (c) 2010-2015 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -57,7 +57,7 @@ function minErr(module, ErrorConstructor) {
57
57
  return match;
58
58
  });
59
59
 
60
- message += '\nhttp://errors.angularjs.org/1.4.0-rc.1/' +
60
+ message += '\nhttp://errors.angularjs.org/1.4.0-rc.2/' +
61
61
  (module ? module + '/' : '') + code;
62
62
 
63
63
  for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -105,6 +105,7 @@ function minErr(module, ErrorConstructor) {
105
105
  isUndefined: true,
106
106
  isDefined: true,
107
107
  isObject: true,
108
+ isBlankObject: true,
108
109
  isString: true,
109
110
  isNumber: true,
110
111
  isDate: true,
@@ -244,6 +245,7 @@ var
244
245
  splice = [].splice,
245
246
  push = [].push,
246
247
  toString = Object.prototype.toString,
248
+ getPrototypeOf = Object.getPrototypeOf,
247
249
  ngMinErr = minErr('ng'),
248
250
 
249
251
  /** @name angular */
@@ -269,7 +271,9 @@ function isArrayLike(obj) {
269
271
  return false;
270
272
  }
271
273
 
272
- var length = obj.length;
274
+ // Support: iOS 8.2 (not reproducible in simulator)
275
+ // "length" in obj used to prevent JIT error (gh-11508)
276
+ var length = "length" in Object(obj) && obj.length;
273
277
 
274
278
  if (obj.nodeType === NODE_TYPE_ELEMENT && length) {
275
279
  return true;
@@ -334,12 +338,25 @@ function forEach(obj, iterator, context) {
334
338
  }
335
339
  } else if (obj.forEach && obj.forEach !== forEach) {
336
340
  obj.forEach(iterator, context, obj);
337
- } else {
341
+ } else if (isBlankObject(obj)) {
342
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
343
+ for (key in obj) {
344
+ iterator.call(context, obj[key], key, obj);
345
+ }
346
+ } else if (typeof obj.hasOwnProperty === 'function') {
347
+ // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
338
348
  for (key in obj) {
339
349
  if (obj.hasOwnProperty(key)) {
340
350
  iterator.call(context, obj[key], key, obj);
341
351
  }
342
352
  }
353
+ } else {
354
+ // Slow path for objects which do not have a method `hasOwnProperty`
355
+ for (key in obj) {
356
+ if (hasOwnProperty.call(obj, key)) {
357
+ iterator.call(context, obj[key], key, obj);
358
+ }
359
+ }
343
360
  }
344
361
  }
345
362
  return obj;
@@ -565,6 +582,16 @@ function isObject(value) {
565
582
  }
566
583
 
567
584
 
585
+ /**
586
+ * Determine if a value is an object with a null prototype
587
+ *
588
+ * @returns {boolean} True if `value` is an `Object` with a null prototype
589
+ */
590
+ function isBlankObject(value) {
591
+ return value !== null && typeof value === 'object' && !getPrototypeOf(value);
592
+ }
593
+
594
+
568
595
  /**
569
596
  * @ngdoc function
570
597
  * @name angular.isString
@@ -848,7 +875,7 @@ function copy(source, destination, stackSource, stackDest) {
848
875
  destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
849
876
  destination.lastIndex = source.lastIndex;
850
877
  } else if (isObject(source)) {
851
- var emptyObject = Object.create(Object.getPrototypeOf(source));
878
+ var emptyObject = Object.create(getPrototypeOf(source));
852
879
  destination = copy(source, emptyObject, stackSource, stackDest);
853
880
  }
854
881
  }
@@ -867,7 +894,7 @@ function copy(source, destination, stackSource, stackDest) {
867
894
  stackDest.push(destination);
868
895
  }
869
896
 
870
- var result;
897
+ var result, key;
871
898
  if (isArray(source)) {
872
899
  destination.length = 0;
873
900
  for (var i = 0; i < source.length; i++) {
@@ -887,21 +914,40 @@ function copy(source, destination, stackSource, stackDest) {
887
914
  delete destination[key];
888
915
  });
889
916
  }
890
- for (var key in source) {
891
- if (source.hasOwnProperty(key)) {
892
- result = copy(source[key], null, stackSource, stackDest);
893
- if (isObject(source[key])) {
894
- stackSource.push(source[key]);
895
- stackDest.push(result);
917
+ if (isBlankObject(source)) {
918
+ // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
919
+ for (key in source) {
920
+ putValue(key, source[key], destination, stackSource, stackDest);
921
+ }
922
+ } else if (source && typeof source.hasOwnProperty === 'function') {
923
+ // Slow path, which must rely on hasOwnProperty
924
+ for (key in source) {
925
+ if (source.hasOwnProperty(key)) {
926
+ putValue(key, source[key], destination, stackSource, stackDest);
927
+ }
928
+ }
929
+ } else {
930
+ // Slowest path --- hasOwnProperty can't be called as a method
931
+ for (key in source) {
932
+ if (hasOwnProperty.call(source, key)) {
933
+ putValue(key, source[key], destination, stackSource, stackDest);
896
934
  }
897
- destination[key] = result;
898
935
  }
899
936
  }
900
937
  setHashKey(destination,h);
901
938
  }
902
-
903
939
  }
904
940
  return destination;
941
+
942
+ function putValue(key, val, destination, stackSource, stackDest) {
943
+ // No context allocation, trivial outer scope, easily inlined
944
+ var result = copy(val, null, stackSource, stackDest);
945
+ if (isObject(val)) {
946
+ stackSource.push(val);
947
+ stackDest.push(result);
948
+ }
949
+ destination[key] = result;
950
+ }
905
951
  }
906
952
 
907
953
  /**
@@ -982,14 +1028,14 @@ function equals(o1, o2) {
982
1028
  } else {
983
1029
  if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
984
1030
  isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
985
- keySet = {};
1031
+ keySet = createMap();
986
1032
  for (key in o1) {
987
1033
  if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
988
1034
  if (!equals(o1[key], o2[key])) return false;
989
1035
  keySet[key] = true;
990
1036
  }
991
1037
  for (key in o2) {
992
- if (!keySet.hasOwnProperty(key) &&
1038
+ if (!(key in keySet) &&
993
1039
  key.charAt(0) !== '$' &&
994
1040
  o2[key] !== undefined &&
995
1041
  !isFunction(o2[key])) return false;
@@ -1026,17 +1072,17 @@ var csp = function() {
1026
1072
  * @name ngJq
1027
1073
  *
1028
1074
  * @element ANY
1029
- * @param {string=} the name of the library available under `window`
1075
+ * @param {string=} ngJq the name of the library available under `window`
1030
1076
  * to be used for angular.element
1031
1077
  * @description
1032
1078
  * Use this directive to force the angular.element library. This should be
1033
1079
  * used to force either jqLite by leaving ng-jq blank or setting the name of
1034
1080
  * the jquery variable under window (eg. jQuery).
1035
1081
  *
1036
- * Since this directive is global for the angular library, it is recommended
1037
- * that it's added to the same element as ng-app or the HTML element, but it is not mandatory.
1038
- * It needs to be noted that only the first instance of `ng-jq` will be used and all others
1039
- * ignored.
1082
+ * Since angular looks for this directive when it is loaded (doesn't wait for the
1083
+ * DOMContentLoaded event), it must be placed on an element that comes before the script
1084
+ * which loads angular. Also, only the first instance of `ng-jq` will be used and all
1085
+ * others ignored.
1040
1086
  *
1041
1087
  * @example
1042
1088
  * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
@@ -2286,11 +2332,11 @@ function toDebugString(obj) {
2286
2332
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
2287
2333
  */
2288
2334
  var version = {
2289
- full: '1.4.0-rc.1', // all of these placeholder strings will be replaced by grunt's
2335
+ full: '1.4.0-rc.2', // all of these placeholder strings will be replaced by grunt's
2290
2336
  major: 1, // package task
2291
2337
  minor: 4,
2292
2338
  dot: 0,
2293
- codeName: 'sartorial-chronography'
2339
+ codeName: 'rocket-zambonimation'
2294
2340
  };
2295
2341
 
2296
2342
 
@@ -2473,7 +2519,7 @@ function publishExternalAPI(angular) {
2473
2519
  * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most
2474
2520
  * commonly needed functionality with the goal of having a very small footprint.</div>
2475
2521
  *
2476
- * To use jQuery, simply load it before `DOMContentLoaded` event fired.
2522
+ * To use `jQuery`, simply ensure it is loaded before the `angular.js` file.
2477
2523
  *
2478
2524
  * <div class="alert">**Note:** all element references in Angular are always wrapped with jQuery or
2479
2525
  * jqLite; they are never raw DOM references.</div>
@@ -2489,7 +2535,7 @@ function publishExternalAPI(angular) {
2489
2535
  * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
2490
2536
  * - [`clone()`](http://api.jquery.com/clone/)
2491
2537
  * - [`contents()`](http://api.jquery.com/contents/)
2492
- * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`
2538
+ * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`. As a setter, does not convert numbers to strings or append 'px'.
2493
2539
  * - [`data()`](http://api.jquery.com/data/)
2494
2540
  * - [`detach()`](http://api.jquery.com/detach/)
2495
2541
  * - [`empty()`](http://api.jquery.com/empty/)
@@ -3733,7 +3779,7 @@ function annotate(fn, strictDi, name) {
3733
3779
  * Return an instance of the service.
3734
3780
  *
3735
3781
  * @param {string} name The name of the instance to retrieve.
3736
- * @param {string} caller An optional string to provide the origin of the function call for error messages.
3782
+ * @param {string=} caller An optional string to provide the origin of the function call for error messages.
3737
3783
  * @return {*} The instance.
3738
3784
  */
3739
3785
 
@@ -3744,8 +3790,8 @@ function annotate(fn, strictDi, name) {
3744
3790
  * @description
3745
3791
  * Invoke the method and supply the method arguments from the `$injector`.
3746
3792
  *
3747
- * @param {!Function} fn The function to invoke. Function parameters are injected according to the
3748
- * {@link guide/di $inject Annotation} rules.
3793
+ * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are
3794
+ * injected according to the {@link guide/di $inject Annotation} rules.
3749
3795
  * @param {Object=} self The `this` for the invoked method.
3750
3796
  * @param {Object=} locals Optional object. If preset then any argument names are read from this
3751
3797
  * object first, before the `$injector` is consulted.
@@ -4012,8 +4058,8 @@ function annotate(fn, strictDi, name) {
4012
4058
  * configure your service in a provider.
4013
4059
  *
4014
4060
  * @param {string} name The name of the instance.
4015
- * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand
4016
- * for `$provide.provider(name, {$get: $getFn})`.
4061
+ * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.
4062
+ * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.
4017
4063
  * @returns {Object} registered provider instance
4018
4064
  *
4019
4065
  * @example
@@ -4048,7 +4094,8 @@ function annotate(fn, strictDi, name) {
4048
4094
  * as a type/class.
4049
4095
  *
4050
4096
  * @param {string} name The name of the instance.
4051
- * @param {Function} constructor A class (constructor function) that will be instantiated.
4097
+ * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)
4098
+ * that will be instantiated.
4052
4099
  * @returns {Object} registered provider instance
4053
4100
  *
4054
4101
  * @example
@@ -4147,7 +4194,7 @@ function annotate(fn, strictDi, name) {
4147
4194
  * object which replaces or wraps and delegates to the original service.
4148
4195
  *
4149
4196
  * @param {string} name The name of the service to decorate.
4150
- * @param {function()} decorator This function will be invoked when the service needs to be
4197
+ * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
4151
4198
  * instantiated and should return the decorated service instance. The function is called using
4152
4199
  * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
4153
4200
  * Local injection arguments:
@@ -4676,6 +4723,7 @@ function $AnchorScrollProvider() {
4676
4723
 
4677
4724
  var $animateMinErr = minErr('$animate');
4678
4725
  var ELEMENT_NODE = 1;
4726
+ var NG_ANIMATE_CLASSNAME = 'ng-animate';
4679
4727
 
4680
4728
  function mergeClasses(a,b) {
4681
4729
  if (!a && !b) return '';
@@ -4700,7 +4748,9 @@ function splitClasses(classes) {
4700
4748
  classes = classes.split(' ');
4701
4749
  }
4702
4750
 
4703
- var obj = {};
4751
+ // Use createMap() to prevent class assumptions involving property names in
4752
+ // Object.prototype
4753
+ var obj = createMap();
4704
4754
  forEach(classes, function(klass) {
4705
4755
  // sometimes the split leaves empty string values
4706
4756
  // incase extra spaces were applied to the options
@@ -4905,6 +4955,13 @@ var $AnimateProvider = ['$provide', function($provide) {
4905
4955
  this.classNameFilter = function(expression) {
4906
4956
  if (arguments.length === 1) {
4907
4957
  this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
4958
+ if (this.$$classNameFilter) {
4959
+ var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
4960
+ if (reservedRegex.test(this.$$classNameFilter.toString())) {
4961
+ throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
4962
+
4963
+ }
4964
+ }
4908
4965
  }
4909
4966
  return this.$$classNameFilter;
4910
4967
  };
@@ -6803,6 +6860,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6803
6860
  if (!letter || letter !== lowercase(letter)) {
6804
6861
  throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
6805
6862
  }
6863
+ if (name !== name.trim()) {
6864
+ throw $compileMinErr('baddir',
6865
+ "Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
6866
+ name);
6867
+ }
6806
6868
  }
6807
6869
 
6808
6870
  /**
@@ -8987,34 +9049,14 @@ var JSON_ENDS = {
8987
9049
  };
8988
9050
  var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
8989
9051
 
8990
- function paramSerializerFactory(jQueryMode) {
8991
-
8992
- function serializeValue(v) {
8993
- if (isObject(v)) {
8994
- return isDate(v) ? v.toISOString() : toJson(v);
8995
- }
8996
- return v;
9052
+ function serializeValue(v) {
9053
+ if (isObject(v)) {
9054
+ return isDate(v) ? v.toISOString() : toJson(v);
8997
9055
  }
8998
-
8999
- return function paramSerializer(params) {
9000
- if (!params) return '';
9001
- var parts = [];
9002
- forEachSorted(params, function(value, key) {
9003
- if (value === null || isUndefined(value)) return;
9004
- if (isArray(value) || isObject(value) && jQueryMode) {
9005
- forEach(value, function(v, k) {
9006
- var keySuffix = jQueryMode ? '[' + (!isArray(value) ? k : '') + ']' : '';
9007
- parts.push(encodeUriQuery(key + keySuffix) + '=' + encodeUriQuery(serializeValue(v)));
9008
- });
9009
- } else {
9010
- parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
9011
- }
9012
- });
9013
-
9014
- return parts.length > 0 ? parts.join('&') : '';
9015
- };
9056
+ return v;
9016
9057
  }
9017
9058
 
9059
+
9018
9060
  function $HttpParamSerializerProvider() {
9019
9061
  /**
9020
9062
  * @ngdoc service
@@ -9029,7 +9071,22 @@ function $HttpParamSerializerProvider() {
9029
9071
  * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D"` (stringified and encoded representation of an object)
9030
9072
  * */
9031
9073
  this.$get = function() {
9032
- return paramSerializerFactory(false);
9074
+ return function ngParamSerializer(params) {
9075
+ if (!params) return '';
9076
+ var parts = [];
9077
+ forEachSorted(params, function(value, key) {
9078
+ if (value === null || isUndefined(value)) return;
9079
+ if (isArray(value)) {
9080
+ forEach(value, function(v, k) {
9081
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
9082
+ });
9083
+ } else {
9084
+ parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
9085
+ }
9086
+ });
9087
+
9088
+ return parts.join('&');
9089
+ };
9033
9090
  };
9034
9091
  }
9035
9092
 
@@ -9042,7 +9099,30 @@ function $HttpParamSerializerJQLikeProvider() {
9042
9099
  * Alternative $http params serializer that follows jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
9043
9100
  * */
9044
9101
  this.$get = function() {
9045
- return paramSerializerFactory(true);
9102
+ return function jQueryLikeParamSerializer(params) {
9103
+ if (!params) return '';
9104
+ var parts = [];
9105
+ serialize(params, '', true);
9106
+ return parts.join('&');
9107
+
9108
+ function serialize(toSerialize, prefix, topLevel) {
9109
+ if (toSerialize === null || isUndefined(toSerialize)) return;
9110
+ if (isArray(toSerialize)) {
9111
+ forEach(toSerialize, function(value) {
9112
+ serialize(value, prefix + '[]');
9113
+ });
9114
+ } else if (isObject(toSerialize) && !isDate(toSerialize)) {
9115
+ forEachSorted(toSerialize, function(value, key) {
9116
+ serialize(value, prefix +
9117
+ (topLevel ? '' : '[') +
9118
+ key +
9119
+ (topLevel ? '' : ']'));
9120
+ });
9121
+ } else {
9122
+ parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
9123
+ }
9124
+ }
9125
+ };
9046
9126
  };
9047
9127
  }
9048
9128
 
@@ -11411,11 +11491,19 @@ var locationPrototype = {
11411
11491
  *
11412
11492
  * Return host of current url.
11413
11493
  *
11494
+ * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
11495
+ *
11414
11496
  *
11415
11497
  * ```js
11416
11498
  * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
11417
11499
  * var host = $location.host();
11418
11500
  * // => "example.com"
11501
+ *
11502
+ * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
11503
+ * host = $location.host();
11504
+ * // => "example.com"
11505
+ * host = location.host;
11506
+ * // => "example.com:8080"
11419
11507
  * ```
11420
11508
  *
11421
11509
  * @return {string} host of current url.
@@ -14172,9 +14260,11 @@ function $ParseProvider() {
14172
14260
  * provide a progress indication, before the promise is resolved or rejected.
14173
14261
  *
14174
14262
  * This method *returns a new promise* which is resolved or rejected via the return value of the
14175
- * `successCallback`, `errorCallback`. It also notifies via the return value of the
14176
- * `notifyCallback` method. The promise cannot be resolved or rejected from the notifyCallback
14177
- * method.
14263
+ * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved
14264
+ * with the value which is resolved in that promise using
14265
+ * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
14266
+ * It also notifies via the return value of the `notifyCallback` method. The promise cannot be
14267
+ * resolved or rejected from the notifyCallback method.
14178
14268
  *
14179
14269
  * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
14180
14270
  *
@@ -14610,7 +14700,7 @@ function $$RAFProvider() { //rAF
14610
14700
  $window.webkitCancelRequestAnimationFrame;
14611
14701
 
14612
14702
  var rafSupported = !!requestAnimationFrame;
14613
- var raf = rafSupported
14703
+ var rafFn = rafSupported
14614
14704
  ? function(fn) {
14615
14705
  var id = requestAnimationFrame(fn);
14616
14706
  return function() {
@@ -14624,9 +14714,47 @@ function $$RAFProvider() { //rAF
14624
14714
  };
14625
14715
  };
14626
14716
 
14627
- raf.supported = rafSupported;
14717
+ queueFn.supported = rafSupported;
14718
+
14719
+ var cancelLastRAF;
14720
+ var taskCount = 0;
14721
+ var taskQueue = [];
14722
+ return queueFn;
14723
+
14724
+ function flush() {
14725
+ for (var i = 0; i < taskQueue.length; i++) {
14726
+ var task = taskQueue[i];
14727
+ if (task) {
14728
+ taskQueue[i] = null;
14729
+ task();
14730
+ }
14731
+ }
14732
+ taskCount = taskQueue.length = 0;
14733
+ }
14734
+
14735
+ function queueFn(asyncFn) {
14736
+ var index = taskQueue.length;
14737
+
14738
+ taskCount++;
14739
+ taskQueue.push(asyncFn);
14628
14740
 
14629
- return raf;
14741
+ if (index === 0) {
14742
+ cancelLastRAF = rafFn(flush);
14743
+ }
14744
+
14745
+ return function cancelQueueFn() {
14746
+ if (index >= 0) {
14747
+ taskQueue[index] = null;
14748
+ index = null;
14749
+
14750
+ if (--taskCount === 0 && cancelLastRAF) {
14751
+ cancelLastRAF();
14752
+ cancelLastRAF = null;
14753
+ taskQueue.length = 0;
14754
+ }
14755
+ }
14756
+ };
14757
+ }
14630
14758
  }];
14631
14759
  }
14632
14760
 
@@ -19932,11 +20060,11 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
19932
20060
  <form name="myForm" ng-controller="FormController" class="my-form">
19933
20061
  userType: <input name="input" ng-model="userType" required>
19934
20062
  <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
19935
- <tt>userType = {{userType}}</tt><br>
19936
- <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
19937
- <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
19938
- <tt>myForm.$valid = {{myForm.$valid}}</tt><br>
19939
- <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
20063
+ <code>userType = {{userType}}</code><br>
20064
+ <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>
20065
+ <code>myForm.input.$error = {{myForm.input.$error}}</code><br>
20066
+ <code>myForm.$valid = {{myForm.$valid}}</code><br>
20067
+ <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>
19940
20068
  </form>
19941
20069
  </file>
19942
20070
  <file name="protractor.js" type="protractor">
@@ -22034,7 +22162,9 @@ function classDirective(name, selector) {
22034
22162
  }
22035
22163
 
22036
22164
  function digestClassCounts(classes, count) {
22037
- var classCounts = element.data('$classCounts') || {};
22165
+ // Use createMap() to prevent class assumptions involving property
22166
+ // names in Object.prototype
22167
+ var classCounts = element.data('$classCounts') || createMap();
22038
22168
  var classesToUpdate = [];
22039
22169
  forEach(classes, function(className) {
22040
22170
  if (count > 0 || classCounts[className]) {
@@ -22417,17 +22547,13 @@ var ngClassEvenDirective = classDirective('Even', 1);
22417
22547
  * document; alternatively, the css rule above must be included in the external stylesheet of the
22418
22548
  * application.
22419
22549
  *
22420
- * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they
22421
- * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css
22422
- * class `ng-cloak` in addition to the `ngCloak` directive as shown in the example below.
22423
- *
22424
22550
  * @element ANY
22425
22551
  *
22426
22552
  * @example
22427
22553
  <example>
22428
22554
  <file name="index.html">
22429
22555
  <div id="template1" ng-cloak>{{ 'hello' }}</div>
22430
- <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
22556
+ <div id="template2" class="ng-cloak">{{ 'world' }}</div>
22431
22557
  </file>
22432
22558
  <file name="protractor.js" type="protractor">
22433
22559
  it('should remove the template directive and css class', function() {
@@ -24456,7 +24582,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
24456
24582
  * If the validity changes to invalid, the model will be set to `undefined`,
24457
24583
  * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
24458
24584
  * If the validity changes to valid, it will set the model to the last available valid
24459
- * modelValue, i.e. either the last parsed value or the last value set from the scope.
24585
+ * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
24460
24586
  */
24461
24587
  this.$validate = function() {
24462
24588
  // ignore $validate before model is initialized
@@ -24948,10 +25074,11 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
24948
25074
  var _name = 'Brian';
24949
25075
  $scope.user = {
24950
25076
  name: function(newName) {
24951
- if (angular.isDefined(newName)) {
24952
- _name = newName;
24953
- }
24954
- return _name;
25077
+ // Note that newName can be undefined for two reasons:
25078
+ // 1. Because it is called as a getter and thus called with no arguments
25079
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
25080
+ // input is invalid
25081
+ return arguments.length ? (_name = newName) : _name;
24955
25082
  }
24956
25083
  };
24957
25084
  }]);
@@ -25165,7 +25292,11 @@ var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
25165
25292
  var _name = 'Brian';
25166
25293
  $scope.user = {
25167
25294
  name: function(newName) {
25168
- return angular.isDefined(newName) ? (_name = newName) : _name;
25295
+ // Note that newName can be undefined for two reasons:
25296
+ // 1. Because it is called as a getter and thus called with no arguments
25297
+ // 2. Because the property should actually be set to undefined. This happens e.g. if the
25298
+ // input is invalid
25299
+ return arguments.length ? (_name = newName) : _name;
25169
25300
  }
25170
25301
  };
25171
25302
  }]);
@@ -25365,11 +25496,21 @@ var ngOptionsMinErr = minErr('ngOptions');
25365
25496
  * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
25366
25497
  * option. See example below for demonstration.
25367
25498
  *
25368
- * <div class="alert alert-warning">
25369
- * **Note:** By default, `ngModel` compares by reference, not value. This is important when binding to an
25370
- * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/). When using `track by`
25371
- * in an `ngOptions` expression, however, deep equality checks will be performed.
25372
- * </div>
25499
+ * ## Complex Models (objects or collections)
25500
+ *
25501
+ * **Note:** By default, `ngModel` watches the model by reference, not value. This is important when
25502
+ * binding any input directive to a model that is an object or a collection.
25503
+ *
25504
+ * Since this is a common situation for `ngOptions` the directive additionally watches the model using
25505
+ * `$watchCollection` when the select has the `multiple` attribute or when there is a `track by` clause in
25506
+ * the options expression. This allows ngOptions to trigger a re-rendering of the options even if the actual
25507
+ * object/collection has not changed identity but only a property on the object or an item in the collection
25508
+ * changes.
25509
+ *
25510
+ * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
25511
+ * if the model is an array). This means that changing a property deeper inside the object/collection that the
25512
+ * first level will not trigger a re-rendering.
25513
+ *
25373
25514
  *
25374
25515
  * ## `select` **`as`**
25375
25516
  *
@@ -25585,9 +25726,13 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25585
25726
  // Get the value by which we are going to track the option
25586
25727
  // if we have a trackFn then use that (passing scope and locals)
25587
25728
  // otherwise just hash the given viewValue
25588
- var getTrackByValue = trackBy ?
25589
- function(viewValue, locals) { return trackByFn(scope, locals); } :
25590
- function getHashOfValue(viewValue) { return hashKey(viewValue); };
25729
+ var getTrackByValueFn = trackBy ?
25730
+ function(value, locals) { return trackByFn(scope, locals); } :
25731
+ function getHashOfValue(value) { return hashKey(value); };
25732
+ var getTrackByValue = function(value, key) {
25733
+ return getTrackByValueFn(value, getLocals(value, key));
25734
+ };
25735
+
25591
25736
  var displayFn = $parse(match[2] || match[1]);
25592
25737
  var groupByFn = $parse(match[3] || '');
25593
25738
  var disableWhenFn = $parse(match[4] || '');
@@ -25614,6 +25759,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25614
25759
 
25615
25760
  return {
25616
25761
  trackBy: trackBy,
25762
+ getTrackByValue: getTrackByValue,
25617
25763
  getWatchables: $parse(valuesFn, function(values) {
25618
25764
  // Create a collection of things that we would like to watch (watchedArray)
25619
25765
  // so that they can all be watched using a single $watchCollection
@@ -25623,11 +25769,11 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25623
25769
 
25624
25770
  Object.keys(values).forEach(function getWatchable(key) {
25625
25771
  var locals = getLocals(values[key], key);
25626
- var selectValue = getTrackByValue(values[key], locals);
25772
+ var selectValue = getTrackByValueFn(values[key], locals);
25627
25773
  watchedArray.push(selectValue);
25628
25774
 
25629
25775
  // Only need to watch the displayFn if there is a specific label expression
25630
- if (match[2]) {
25776
+ if (match[2] || match[1]) {
25631
25777
  var label = displayFn(scope, locals);
25632
25778
  watchedArray.push(label);
25633
25779
  }
@@ -25649,17 +25795,29 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25649
25795
  // The option values were already computed in the `getWatchables` fn,
25650
25796
  // which must have been called to trigger `getOptions`
25651
25797
  var optionValues = valuesFn(scope) || [];
25798
+ var optionValuesKeys;
25652
25799
 
25653
- var keys = Object.keys(optionValues);
25654
- keys.forEach(function getOption(key) {
25655
25800
 
25656
- // Ignore "angular" properties that start with $ or $$
25657
- if (key.charAt(0) === '$') return;
25801
+ if (!keyName && isArrayLike(optionValues)) {
25802
+ optionValuesKeys = optionValues;
25803
+ } else {
25804
+ // if object, extract keys, in enumeration order, unsorted
25805
+ optionValuesKeys = [];
25806
+ for (var itemKey in optionValues) {
25807
+ if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {
25808
+ optionValuesKeys.push(itemKey);
25809
+ }
25810
+ }
25811
+ }
25812
+
25813
+ var optionValuesLength = optionValuesKeys.length;
25658
25814
 
25815
+ for (var index = 0; index < optionValuesLength; index++) {
25816
+ var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
25659
25817
  var value = optionValues[key];
25660
25818
  var locals = getLocals(value, key);
25661
25819
  var viewValue = viewValueFn(scope, locals);
25662
- var selectValue = getTrackByValue(viewValue, locals);
25820
+ var selectValue = getTrackByValueFn(viewValue, locals);
25663
25821
  var label = displayFn(scope, locals);
25664
25822
  var group = groupByFn(scope, locals);
25665
25823
  var disabled = disableWhenFn(scope, locals);
@@ -25667,13 +25825,13 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25667
25825
 
25668
25826
  optionItems.push(optionItem);
25669
25827
  selectValueMap[selectValue] = optionItem;
25670
- });
25828
+ }
25671
25829
 
25672
25830
  return {
25673
25831
  items: optionItems,
25674
25832
  selectValueMap: selectValueMap,
25675
25833
  getOptionFromViewValue: function(value) {
25676
- return selectValueMap[getTrackByValue(value, getLocals(value))];
25834
+ return selectValueMap[getTrackByValue(value)];
25677
25835
  },
25678
25836
  getViewValueFromOption: function(option) {
25679
25837
  // If the viewValue could be an object that may be mutated by the application,
@@ -25751,44 +25909,54 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25751
25909
  };
25752
25910
 
25753
25911
 
25754
- selectCtrl.writeValue = function writeNgOptionsValue(value) {
25755
- var option = options.getOptionFromViewValue(value);
25912
+ // Update the controller methods for multiple selectable options
25913
+ if (!multiple) {
25756
25914
 
25757
- if (option && !option.disabled) {
25758
- if (selectElement[0].value !== option.selectValue) {
25759
- removeUnknownOption();
25760
- removeEmptyOption();
25915
+ selectCtrl.writeValue = function writeNgOptionsValue(value) {
25916
+ var option = options.getOptionFromViewValue(value);
25761
25917
 
25762
- selectElement[0].value = option.selectValue;
25763
- option.element.selected = true;
25764
- option.element.setAttribute('selected', 'selected');
25765
- }
25766
- } else {
25767
- if (value === null || providedEmptyOption) {
25768
- removeUnknownOption();
25769
- renderEmptyOption();
25918
+ if (option && !option.disabled) {
25919
+ if (selectElement[0].value !== option.selectValue) {
25920
+ removeUnknownOption();
25921
+ removeEmptyOption();
25922
+
25923
+ selectElement[0].value = option.selectValue;
25924
+ option.element.selected = true;
25925
+ option.element.setAttribute('selected', 'selected');
25926
+ }
25770
25927
  } else {
25771
- removeEmptyOption();
25772
- renderUnknownOption();
25928
+ if (value === null || providedEmptyOption) {
25929
+ removeUnknownOption();
25930
+ renderEmptyOption();
25931
+ } else {
25932
+ removeEmptyOption();
25933
+ renderUnknownOption();
25934
+ }
25773
25935
  }
25774
- }
25775
- };
25936
+ };
25776
25937
 
25777
- selectCtrl.readValue = function readNgOptionsValue() {
25938
+ selectCtrl.readValue = function readNgOptionsValue() {
25778
25939
 
25779
- var selectedOption = options.selectValueMap[selectElement.val()];
25940
+ var selectedOption = options.selectValueMap[selectElement.val()];
25780
25941
 
25781
- if (selectedOption && !selectedOption.disabled) {
25782
- removeEmptyOption();
25783
- removeUnknownOption();
25784
- return options.getViewValueFromOption(selectedOption);
25785
- }
25786
- return null;
25787
- };
25942
+ if (selectedOption && !selectedOption.disabled) {
25943
+ removeEmptyOption();
25944
+ removeUnknownOption();
25945
+ return options.getViewValueFromOption(selectedOption);
25946
+ }
25947
+ return null;
25948
+ };
25788
25949
 
25950
+ // If we are using `track by` then we must watch the tracked value on the model
25951
+ // since ngModel only watches for object identity change
25952
+ if (ngOptions.trackBy) {
25953
+ scope.$watch(
25954
+ function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
25955
+ function() { ngModelCtrl.$render(); }
25956
+ );
25957
+ }
25789
25958
 
25790
- // Update the controller methods for multiple selectable options
25791
- if (multiple) {
25959
+ } else {
25792
25960
 
25793
25961
  ngModelCtrl.$isEmpty = function(value) {
25794
25962
  return !value || value.length === 0;
@@ -25820,6 +25988,22 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25820
25988
 
25821
25989
  return selections;
25822
25990
  };
25991
+
25992
+ // If we are using `track by` then we must watch these tracked values on the model
25993
+ // since ngModel only watches for object identity change
25994
+ if (ngOptions.trackBy) {
25995
+
25996
+ scope.$watchCollection(function() {
25997
+ if (isArray(ngModelCtrl.$viewValue)) {
25998
+ return ngModelCtrl.$viewValue.map(function(value) {
25999
+ return ngOptions.getTrackByValue(value);
26000
+ });
26001
+ }
26002
+ }, function() {
26003
+ ngModelCtrl.$render();
26004
+ });
26005
+
26006
+ }
25823
26007
  }
25824
26008
 
25825
26009
 
@@ -25846,11 +26030,6 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25846
26030
  // We will re-render the option elements if the option values or labels change
25847
26031
  scope.$watchCollection(ngOptions.getWatchables, updateOptions);
25848
26032
 
25849
- // We also need to watch to see if the internals of the model changes, since
25850
- // ngModel only watches for object identity change
25851
- if (ngOptions.trackBy) {
25852
- scope.$watch(attr.ngModel, function() { ngModelCtrl.$render(); }, true);
25853
- }
25854
26033
  // ------------------------------------------------------------------ //
25855
26034
 
25856
26035
 
@@ -27194,7 +27373,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
27194
27373
  *
27195
27374
  * @scope
27196
27375
  * @priority 1200
27197
- * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
27376
+ * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
27198
27377
  * On child elements add:
27199
27378
  *
27200
27379
  * * `ngSwitchWhen`: the case statement to match against. If match then this
@@ -27211,7 +27390,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
27211
27390
  <div ng-controller="ExampleController">
27212
27391
  <select ng-model="selection" ng-options="item for item in items">
27213
27392
  </select>
27214
- <tt>selection={{selection}}</tt>
27393
+ <code>selection={{selection}}</code>
27215
27394
  <hr/>
27216
27395
  <div class="animate-switch-container"
27217
27396
  ng-switch on="selection">
@@ -27602,12 +27781,6 @@ var SelectController =
27602
27781
  * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
27603
27782
  * option. See example below for demonstration.
27604
27783
  *
27605
- * <div class="alert alert-warning">
27606
- * **Note:** By default, `ngModel` compares by reference, not value. This is important when binding to an
27607
- * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/). When using `track by`
27608
- * in an `ngOptions` expression, however, deep equality checks will be performed.
27609
- * </div>
27610
- *
27611
27784
  */
27612
27785
  var selectDirective = function() {
27613
27786
 
@@ -27869,4 +28042,4 @@ var minlengthDirective = function() {
27869
28042
 
27870
28043
  })(window, document);
27871
28044
 
27872
- !window.angular.$$csp() && window.angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-animate-anchor{position:absolute;}</style>');
28045
+ !window.angular.$$csp() && window.angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');