rails-angularjs 1.3.14 → 1.3.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/rails-angularjs/version.rb +2 -2
  4. data/vendor/assets/javascripts/angular-animate.js +1 -1
  5. data/vendor/assets/javascripts/angular-animate.min.js +1 -1
  6. data/vendor/assets/javascripts/angular-animate.min.js.map +8 -0
  7. data/vendor/assets/javascripts/angular-aria.js +19 -4
  8. data/vendor/assets/javascripts/angular-aria.min.js +8 -7
  9. data/vendor/assets/javascripts/angular-aria.min.js.map +8 -0
  10. data/vendor/assets/javascripts/angular-cookies.js +1 -1
  11. data/vendor/assets/javascripts/angular-cookies.min.js +1 -1
  12. data/vendor/assets/javascripts/angular-cookies.min.js.map +8 -0
  13. data/vendor/assets/javascripts/angular-loader.js +2 -2
  14. data/vendor/assets/javascripts/angular-loader.min.js +2 -2
  15. data/vendor/assets/javascripts/angular-loader.min.js.map +8 -0
  16. data/vendor/assets/javascripts/angular-messages.js +4 -3
  17. data/vendor/assets/javascripts/angular-messages.min.js +1 -1
  18. data/vendor/assets/javascripts/angular-messages.min.js.map +8 -0
  19. data/vendor/assets/javascripts/angular-mocks.js +73 -1
  20. data/vendor/assets/javascripts/angular-resource.js +1 -1
  21. data/vendor/assets/javascripts/angular-resource.min.js +1 -1
  22. data/vendor/assets/javascripts/angular-resource.min.js.map +8 -0
  23. data/vendor/assets/javascripts/angular-route.js +1 -1
  24. data/vendor/assets/javascripts/angular-route.min.js +1 -1
  25. data/vendor/assets/javascripts/angular-route.min.js.map +8 -0
  26. data/vendor/assets/javascripts/angular-sanitize.js +12 -1
  27. data/vendor/assets/javascripts/angular-sanitize.min.js +1 -1
  28. data/vendor/assets/javascripts/angular-sanitize.min.js.map +8 -0
  29. data/vendor/assets/javascripts/angular-scenario.js +177 -49
  30. data/vendor/assets/javascripts/angular-touch.js +1 -1
  31. data/vendor/assets/javascripts/angular-touch.min.js +1 -1
  32. data/vendor/assets/javascripts/angular-touch.min.js.map +8 -0
  33. data/vendor/assets/javascripts/angular.js +177 -49
  34. data/vendor/assets/javascripts/angular.min.js +242 -241
  35. data/vendor/assets/javascripts/angular.min.js.map +8 -0
  36. data/vendor/assets/javascripts/unstable/angular-animate.js +1 -1
  37. data/vendor/assets/javascripts/unstable/angular-animate.min.js +1 -1
  38. data/vendor/assets/javascripts/unstable/angular-animate.min.js.map +8 -0
  39. data/vendor/assets/javascripts/unstable/angular-aria.js +19 -4
  40. data/vendor/assets/javascripts/unstable/angular-aria.min.js +8 -7
  41. data/vendor/assets/javascripts/unstable/angular-aria.min.js.map +8 -0
  42. data/vendor/assets/javascripts/unstable/angular-cookies.js +254 -140
  43. data/vendor/assets/javascripts/unstable/angular-cookies.min.js +4 -3
  44. data/vendor/assets/javascripts/unstable/angular-cookies.min.js.map +8 -0
  45. data/vendor/assets/javascripts/unstable/angular-loader.js +2 -2
  46. data/vendor/assets/javascripts/unstable/angular-loader.min.js +2 -2
  47. data/vendor/assets/javascripts/unstable/angular-loader.min.js.map +8 -0
  48. data/vendor/assets/javascripts/unstable/angular-messages.js +47 -24
  49. data/vendor/assets/javascripts/unstable/angular-messages.min.js +6 -7
  50. data/vendor/assets/javascripts/unstable/angular-messages.min.js.map +8 -0
  51. data/vendor/assets/javascripts/unstable/angular-mocks.js +80 -30
  52. data/vendor/assets/javascripts/unstable/angular-resource.js +1 -1
  53. data/vendor/assets/javascripts/unstable/angular-resource.min.js +1 -1
  54. data/vendor/assets/javascripts/unstable/angular-resource.min.js.map +8 -0
  55. data/vendor/assets/javascripts/unstable/angular-route.js +1 -1
  56. data/vendor/assets/javascripts/unstable/angular-route.min.js +1 -1
  57. data/vendor/assets/javascripts/unstable/angular-route.min.js.map +8 -0
  58. data/vendor/assets/javascripts/unstable/angular-sanitize.js +31 -20
  59. data/vendor/assets/javascripts/unstable/angular-sanitize.min.js +3 -3
  60. data/vendor/assets/javascripts/unstable/angular-sanitize.min.js.map +8 -0
  61. data/vendor/assets/javascripts/unstable/angular-scenario.js +378 -230
  62. data/vendor/assets/javascripts/unstable/angular-touch.js +1 -1
  63. data/vendor/assets/javascripts/unstable/angular-touch.min.js +1 -1
  64. data/vendor/assets/javascripts/unstable/angular-touch.min.js.map +8 -0
  65. data/vendor/assets/javascripts/unstable/angular.js +377 -229
  66. data/vendor/assets/javascripts/unstable/angular.min.js +278 -277
  67. data/vendor/assets/javascripts/unstable/angular.min.js.map +8 -0
  68. metadata +25 -5
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.4.0-beta.5
2
+ * @license AngularJS v1.4.0-beta.6
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-beta.5/' +
60
+ message += '\nhttp://errors.angularjs.org/1.4.0-beta.6/' +
61
61
  (module ? module + '/' : '') + code;
62
62
 
63
63
  for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -98,6 +98,7 @@ function minErr(module, ErrorConstructor) {
98
98
  extend: true,
99
99
  toInt: true,
100
100
  inherit: true,
101
+ merge: true,
101
102
  noop: true,
102
103
  identity: true,
103
104
  valueFn: true,
@@ -134,6 +135,8 @@ function minErr(module, ErrorConstructor) {
134
135
  toJsonReplacer: true,
135
136
  toJson: true,
136
137
  fromJson: true,
138
+ convertTimezoneToLocal: true,
139
+ timezoneToOffset: true,
137
140
  startingTag: true,
138
141
  tryDecodeURIComponent: true,
139
142
  parseKeyValue: true,
@@ -154,6 +157,7 @@ function minErr(module, ErrorConstructor) {
154
157
  createMap: true,
155
158
 
156
159
  NODE_TYPE_ELEMENT: true,
160
+ NODE_TYPE_ATTRIBUTE: true,
157
161
  NODE_TYPE_TEXT: true,
158
162
  NODE_TYPE_COMMENT: true,
159
163
  NODE_TYPE_DOCUMENT: true,
@@ -387,6 +391,31 @@ function setHashKey(obj, h) {
387
391
  }
388
392
  }
389
393
 
394
+
395
+ function baseExtend(dst, objs, deep) {
396
+ var h = dst.$$hashKey;
397
+
398
+ for (var i = 0, ii = objs.length; i < ii; ++i) {
399
+ var obj = objs[i];
400
+ if (!isObject(obj) && !isFunction(obj)) continue;
401
+ var keys = Object.keys(obj);
402
+ for (var j = 0, jj = keys.length; j < jj; j++) {
403
+ var key = keys[j];
404
+ var src = obj[key];
405
+
406
+ if (deep && isObject(src)) {
407
+ if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
408
+ baseExtend(dst[key], [src], true);
409
+ } else {
410
+ dst[key] = src;
411
+ }
412
+ }
413
+ }
414
+
415
+ setHashKey(dst, h);
416
+ return dst;
417
+ }
418
+
390
419
  /**
391
420
  * @ngdoc function
392
421
  * @name angular.extend
@@ -397,30 +426,43 @@ function setHashKey(obj, h) {
397
426
  * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
398
427
  * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
399
428
  * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.
400
- * Note: Keep in mind that `angular.extend` does not support recursive merge (deep copy).
429
+ *
430
+ * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use
431
+ * {@link angular.merge} for this.
401
432
  *
402
433
  * @param {Object} dst Destination object.
403
434
  * @param {...Object} src Source object(s).
404
435
  * @returns {Object} Reference to `dst`.
405
436
  */
406
437
  function extend(dst) {
407
- var h = dst.$$hashKey;
438
+ return baseExtend(dst, slice.call(arguments, 1), false);
439
+ }
408
440
 
409
- for (var i = 1, ii = arguments.length; i < ii; i++) {
410
- var obj = arguments[i];
411
- if (obj) {
412
- var keys = Object.keys(obj);
413
- for (var j = 0, jj = keys.length; j < jj; j++) {
414
- var key = keys[j];
415
- dst[key] = obj[key];
416
- }
417
- }
418
- }
419
441
 
420
- setHashKey(dst, h);
421
- return dst;
442
+ /**
443
+ * @ngdoc function
444
+ * @name angular.merge
445
+ * @module ng
446
+ * @kind function
447
+ *
448
+ * @description
449
+ * Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
450
+ * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
451
+ * by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.
452
+ *
453
+ * Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source
454
+ * objects, performing a deep copy.
455
+ *
456
+ * @param {Object} dst Destination object.
457
+ * @param {...Object} src Source object(s).
458
+ * @returns {Object} Reference to `dst`.
459
+ */
460
+ function merge(dst) {
461
+ return baseExtend(dst, slice.call(arguments, 1), true);
422
462
  }
423
463
 
464
+
465
+
424
466
  function toInt(str) {
425
467
  return parseInt(str, 10);
426
468
  }
@@ -547,6 +589,12 @@ function isString(value) {return typeof value === 'string';}
547
589
  * @description
548
590
  * Determines if a reference is a `Number`.
549
591
  *
592
+ * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`.
593
+ *
594
+ * If you wish to exclude these then you can use the native
595
+ * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
596
+ * method.
597
+ *
550
598
  * @param {*} value Reference to check.
551
599
  * @returns {boolean} True if `value` is a `Number`.
552
600
  */
@@ -929,10 +977,11 @@ function equals(o1, o2) {
929
977
  } else if (isDate(o1)) {
930
978
  if (!isDate(o2)) return false;
931
979
  return equals(o1.getTime(), o2.getTime());
932
- } else if (isRegExp(o1) && isRegExp(o2)) {
933
- return o1.toString() == o2.toString();
980
+ } else if (isRegExp(o1)) {
981
+ return isRegExp(o2) ? o1.toString() == o2.toString() : false;
934
982
  } else {
935
- if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;
983
+ if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
984
+ isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
936
985
  keySet = {};
937
986
  for (key in o1) {
938
987
  if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
@@ -1012,18 +1061,15 @@ var csp = function() {
1012
1061
  var jq = function() {
1013
1062
  if (isDefined(jq.name_)) return jq.name_;
1014
1063
  var el;
1015
- var i, ii = ngAttrPrefixes.length;
1064
+ var i, ii = ngAttrPrefixes.length, prefix, name;
1016
1065
  for (i = 0; i < ii; ++i) {
1017
- if (el = document.querySelector('[' + ngAttrPrefixes[i].replace(':', '\\:') + 'jq]')) {
1066
+ prefix = ngAttrPrefixes[i];
1067
+ if (el = document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
1068
+ name = el.getAttribute(prefix + 'jq');
1018
1069
  break;
1019
1070
  }
1020
1071
  }
1021
1072
 
1022
- var name;
1023
- if (el) {
1024
- name = getNgAttribute(el, "jq");
1025
- }
1026
-
1027
1073
  return (jq.name_ = name);
1028
1074
  };
1029
1075
 
@@ -1136,6 +1182,26 @@ function fromJson(json) {
1136
1182
  }
1137
1183
 
1138
1184
 
1185
+ function timezoneToOffset(timezone, fallback) {
1186
+ var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
1187
+ return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
1188
+ }
1189
+
1190
+
1191
+ function addDateMinutes(date, minutes) {
1192
+ date = new Date(date.getTime());
1193
+ date.setMinutes(date.getMinutes() + minutes);
1194
+ return date;
1195
+ }
1196
+
1197
+
1198
+ function convertTimezoneToLocal(date, timezone, reverse) {
1199
+ reverse = reverse ? -1 : 1;
1200
+ var timezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());
1201
+ return addDateMinutes(date, reverse * (timezoneOffset - date.getTimezoneOffset()));
1202
+ }
1203
+
1204
+
1139
1205
  /**
1140
1206
  * @returns {string} Returns the string representation of the element.
1141
1207
  */
@@ -1264,10 +1330,9 @@ var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
1264
1330
 
1265
1331
  function getNgAttribute(element, ngAttr) {
1266
1332
  var attr, i, ii = ngAttrPrefixes.length;
1267
- element = jqLite(element);
1268
1333
  for (i = 0; i < ii; ++i) {
1269
1334
  attr = ngAttrPrefixes[i] + ngAttr;
1270
- if (isString(attr = element.attr(attr))) {
1335
+ if (isString(attr = element.getAttribute(attr))) {
1271
1336
  return attr;
1272
1337
  }
1273
1338
  }
@@ -1742,6 +1807,7 @@ function createMap() {
1742
1807
  }
1743
1808
 
1744
1809
  var NODE_TYPE_ELEMENT = 1;
1810
+ var NODE_TYPE_ATTRIBUTE = 2;
1745
1811
  var NODE_TYPE_TEXT = 3;
1746
1812
  var NODE_TYPE_COMMENT = 8;
1747
1813
  var NODE_TYPE_DOCUMENT = 9;
@@ -2157,6 +2223,7 @@ function toDebugString(obj) {
2157
2223
  $FilterProvider,
2158
2224
  $InterpolateProvider,
2159
2225
  $IntervalProvider,
2226
+ $$HashMapProvider,
2160
2227
  $HttpProvider,
2161
2228
  $HttpBackendProvider,
2162
2229
  $LocationProvider,
@@ -2176,7 +2243,8 @@ function toDebugString(obj) {
2176
2243
  $$RAFProvider,
2177
2244
  $$AsyncCallbackProvider,
2178
2245
  $WindowProvider,
2179
- $$jqLiteProvider
2246
+ $$jqLiteProvider,
2247
+ $$CookieReaderProvider
2180
2248
  */
2181
2249
 
2182
2250
 
@@ -2195,11 +2263,11 @@ function toDebugString(obj) {
2195
2263
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
2196
2264
  */
2197
2265
  var version = {
2198
- full: '1.4.0-beta.5', // all of these placeholder strings will be replaced by grunt's
2266
+ full: '1.4.0-beta.6', // all of these placeholder strings will be replaced by grunt's
2199
2267
  major: 1, // package task
2200
2268
  minor: 4,
2201
2269
  dot: 0,
2202
- codeName: 'karmic-stabilization'
2270
+ codeName: 'cookie-liberation'
2203
2271
  };
2204
2272
 
2205
2273
 
@@ -2208,6 +2276,7 @@ function publishExternalAPI(angular) {
2208
2276
  'bootstrap': bootstrap,
2209
2277
  'copy': copy,
2210
2278
  'extend': extend,
2279
+ 'merge': merge,
2211
2280
  'equals': equals,
2212
2281
  'element': jqLite,
2213
2282
  'forEach': forEach,
@@ -2330,12 +2399,25 @@ function publishExternalAPI(angular) {
2330
2399
  $window: $WindowProvider,
2331
2400
  $$rAF: $$RAFProvider,
2332
2401
  $$asyncCallback: $$AsyncCallbackProvider,
2333
- $$jqLite: $$jqLiteProvider
2402
+ $$jqLite: $$jqLiteProvider,
2403
+ $$HashMap: $$HashMapProvider,
2404
+ $$cookieReader: $$CookieReaderProvider
2334
2405
  });
2335
2406
  }
2336
2407
  ]);
2337
2408
  }
2338
2409
 
2410
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2411
+ * Any commits to this file should be reviewed with security in mind. *
2412
+ * Changes to this file can potentially create security vulnerabilities. *
2413
+ * An approval from 2 Core members with history of modifying *
2414
+ * this file is required. *
2415
+ * *
2416
+ * Does the change somehow allow for arbitrary javascript to be executed? *
2417
+ * Or allows for someone to change the prototype of built-in objects? *
2418
+ * Or gives undesired access to variables likes document or window? *
2419
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2420
+
2339
2421
  /* global JQLitePrototype: true,
2340
2422
  addEventListenerFn: true,
2341
2423
  removeEventListenerFn: true,
@@ -2923,6 +3005,10 @@ forEach({
2923
3005
  },
2924
3006
 
2925
3007
  attr: function(element, name, value) {
3008
+ var nodeType = element.nodeType;
3009
+ if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {
3010
+ return;
3011
+ }
2926
3012
  var lowercasedName = lowercase(name);
2927
3013
  if (BOOLEAN_ATTR[lowercasedName]) {
2928
3014
  if (isDefined(value)) {
@@ -3435,6 +3521,12 @@ HashMap.prototype = {
3435
3521
  }
3436
3522
  };
3437
3523
 
3524
+ var $$HashMapProvider = [function() {
3525
+ this.$get = [function() {
3526
+ return HashMap;
3527
+ }];
3528
+ }];
3529
+
3438
3530
  /**
3439
3531
  * @ngdoc function
3440
3532
  * @module ng
@@ -4760,6 +4852,7 @@ var $AnimateProvider = ['$provide', function($provide) {
4760
4852
  * @return {Promise} the animation callback promise
4761
4853
  */
4762
4854
  leave: function(element, options) {
4855
+ applyStyles(element, options);
4763
4856
  element.remove();
4764
4857
  return asyncPromise();
4765
4858
  },
@@ -5004,11 +5097,6 @@ function Browser(window, document, $log, $sniffer) {
5004
5097
  * @param {function()} callback Function that will be called when no outstanding request
5005
5098
  */
5006
5099
  self.notifyWhenNoOutstandingRequests = function(callback) {
5007
- // force browser to execute all pollFns - this is needed so that cookies and other pollers fire
5008
- // at some deterministic time in respect to the test runner's actions. Leaving things up to the
5009
- // regular poller would result in flaky tests.
5010
- forEach(pollFns, function(pollFn) { pollFn(); });
5011
-
5012
5100
  if (outstandingRequestCount === 0) {
5013
5101
  callback();
5014
5102
  } else {
@@ -5016,44 +5104,6 @@ function Browser(window, document, $log, $sniffer) {
5016
5104
  }
5017
5105
  };
5018
5106
 
5019
- //////////////////////////////////////////////////////////////
5020
- // Poll Watcher API
5021
- //////////////////////////////////////////////////////////////
5022
- var pollFns = [],
5023
- pollTimeout;
5024
-
5025
- /**
5026
- * @name $browser#addPollFn
5027
- *
5028
- * @param {function()} fn Poll function to add
5029
- *
5030
- * @description
5031
- * Adds a function to the list of functions that poller periodically executes,
5032
- * and starts polling if not started yet.
5033
- *
5034
- * @returns {function()} the added function
5035
- */
5036
- self.addPollFn = function(fn) {
5037
- if (isUndefined(pollTimeout)) startPoller(100, setTimeout);
5038
- pollFns.push(fn);
5039
- return fn;
5040
- };
5041
-
5042
- /**
5043
- * @param {number} interval How often should browser call poll functions (ms)
5044
- * @param {function()} setTimeout Reference to a real or fake `setTimeout` function.
5045
- *
5046
- * @description
5047
- * Configures the poller to run in the specified intervals, using the specified
5048
- * setTimeout fn and kicks it off.
5049
- */
5050
- function startPoller(interval, setTimeout) {
5051
- (function check() {
5052
- forEach(pollFns, function(pollFn) { pollFn(); });
5053
- pollTimeout = setTimeout(check, interval);
5054
- })();
5055
- }
5056
-
5057
5107
  //////////////////////////////////////////////////////////////
5058
5108
  // URL API
5059
5109
  //////////////////////////////////////////////////////////////
@@ -5164,11 +5214,19 @@ function Browser(window, document, $log, $sniffer) {
5164
5214
  fireUrlChange();
5165
5215
  }
5166
5216
 
5217
+ function getCurrentState() {
5218
+ try {
5219
+ return history.state;
5220
+ } catch (e) {
5221
+ // MSIE can reportedly throw when there is no state (UNCONFIRMED).
5222
+ }
5223
+ }
5224
+
5167
5225
  // This variable should be used *only* inside the cacheState function.
5168
5226
  var lastCachedState = null;
5169
5227
  function cacheState() {
5170
5228
  // This should be the only place in $browser where `history.state` is read.
5171
- cachedState = window.history.state;
5229
+ cachedState = getCurrentState();
5172
5230
  cachedState = isUndefined(cachedState) ? null : cachedState;
5173
5231
 
5174
5232
  // Prevent callbacks fo fire twice if both hashchange & popstate were fired.
@@ -5255,89 +5313,6 @@ function Browser(window, document, $log, $sniffer) {
5255
5313
  return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
5256
5314
  };
5257
5315
 
5258
- //////////////////////////////////////////////////////////////
5259
- // Cookies API
5260
- //////////////////////////////////////////////////////////////
5261
- var lastCookies = {};
5262
- var lastCookieString = '';
5263
- var cookiePath = self.baseHref();
5264
-
5265
- function safeDecodeURIComponent(str) {
5266
- try {
5267
- return decodeURIComponent(str);
5268
- } catch (e) {
5269
- return str;
5270
- }
5271
- }
5272
-
5273
- /**
5274
- * @name $browser#cookies
5275
- *
5276
- * @param {string=} name Cookie name
5277
- * @param {string=} value Cookie value
5278
- *
5279
- * @description
5280
- * The cookies method provides a 'private' low level access to browser cookies.
5281
- * It is not meant to be used directly, use the $cookie service instead.
5282
- *
5283
- * The return values vary depending on the arguments that the method was called with as follows:
5284
- *
5285
- * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify
5286
- * it
5287
- * - cookies(name, value) -> set name to value, if value is undefined delete the cookie
5288
- * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that
5289
- * way)
5290
- *
5291
- * @returns {Object} Hash of all cookies (if called without any parameter)
5292
- */
5293
- self.cookies = function(name, value) {
5294
- var cookieLength, cookieArray, cookie, i, index;
5295
-
5296
- if (name) {
5297
- if (value === undefined) {
5298
- rawDocument.cookie = encodeURIComponent(name) + "=;path=" + cookiePath +
5299
- ";expires=Thu, 01 Jan 1970 00:00:00 GMT";
5300
- } else {
5301
- if (isString(value)) {
5302
- cookieLength = (rawDocument.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) +
5303
- ';path=' + cookiePath).length + 1;
5304
-
5305
- // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
5306
- // - 300 cookies
5307
- // - 20 cookies per unique domain
5308
- // - 4096 bytes per cookie
5309
- if (cookieLength > 4096) {
5310
- $log.warn("Cookie '" + name +
5311
- "' possibly not set or overflowed because it was too large (" +
5312
- cookieLength + " > 4096 bytes)!");
5313
- }
5314
- }
5315
- }
5316
- } else {
5317
- if (rawDocument.cookie !== lastCookieString) {
5318
- lastCookieString = rawDocument.cookie;
5319
- cookieArray = lastCookieString.split("; ");
5320
- lastCookies = {};
5321
-
5322
- for (i = 0; i < cookieArray.length; i++) {
5323
- cookie = cookieArray[i];
5324
- index = cookie.indexOf('=');
5325
- if (index > 0) { //ignore nameless cookies
5326
- name = safeDecodeURIComponent(cookie.substring(0, index));
5327
- // the first value that is seen for a cookie is the most
5328
- // specific one. values for the same cookie name that
5329
- // follow are for less specific paths.
5330
- if (lastCookies[name] === undefined) {
5331
- lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
5332
- }
5333
- }
5334
- }
5335
- }
5336
- return lastCookies;
5337
- }
5338
- };
5339
-
5340
-
5341
5316
  /**
5342
5317
  * @name $browser#defer
5343
5318
  * @param {function()} fn A function, who's execution should be deferred.
@@ -5765,7 +5740,7 @@ function $CacheFactoryProvider() {
5765
5740
  * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,
5766
5741
  * element with ng-app attribute), otherwise the template will be ignored.
5767
5742
  *
5768
- * Adding via the $templateCache service:
5743
+ * Adding via the `$templateCache` service:
5769
5744
  *
5770
5745
  * ```js
5771
5746
  * var myApp = angular.module('myApp', []);
@@ -5793,6 +5768,17 @@ function $TemplateCacheProvider() {
5793
5768
  }];
5794
5769
  }
5795
5770
 
5771
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5772
+ * Any commits to this file should be reviewed with security in mind. *
5773
+ * Changes to this file can potentially create security vulnerabilities. *
5774
+ * An approval from 2 Core members with history of modifying *
5775
+ * this file is required. *
5776
+ * *
5777
+ * Does the change somehow allow for arbitrary javascript to be executed? *
5778
+ * Or allows for someone to change the prototype of built-in objects? *
5779
+ * Or gives undesired access to variables likes document or window? *
5780
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5781
+
5796
5782
  /* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
5797
5783
  *
5798
5784
  * DOM-related variables:
@@ -6004,7 +5990,8 @@ function $TemplateCacheProvider() {
6004
5990
  * Require another directive and inject its controller as the fourth argument to the linking function. The
6005
5991
  * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the
6006
5992
  * injected argument will be an array in corresponding order. If no such directive can be
6007
- * found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with:
5993
+ * found, or if the directive does not have a controller, then an error is raised (unless no link function
5994
+ * is specified, in which case error checking is skipped). The name can be prefixed with:
6008
5995
  *
6009
5996
  * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
6010
5997
  * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
@@ -6139,7 +6126,7 @@ function $TemplateCacheProvider() {
6139
6126
  * `templateUrl` declaration or manual compilation inside the compile function.
6140
6127
  * </div>
6141
6128
  *
6142
- * <div class="alert alert-error">
6129
+ * <div class="alert alert-danger">
6143
6130
  * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
6144
6131
  * e.g. does not know about the right outer scope. Please use the transclude function that is passed
6145
6132
  * to the link function instead.
@@ -6418,7 +6405,7 @@ function $TemplateCacheProvider() {
6418
6405
  * @param {string|DOMElement} element Element or HTML string to compile into a template function.
6419
6406
  * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.
6420
6407
  *
6421
- * <div class="alert alert-error">
6408
+ * <div class="alert alert-danger">
6422
6409
  * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it
6423
6410
  * e.g. will not use the right outer scope. Please pass the transclude function as a
6424
6411
  * `parentBoundTranscludeFn` to the link function instead.
@@ -8961,8 +8948,8 @@ function $HttpProvider() {
8961
8948
  **/
8962
8949
  var interceptorFactories = this.interceptors = [];
8963
8950
 
8964
- this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',
8965
- function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
8951
+ this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',
8952
+ function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
8966
8953
 
8967
8954
  var defaultCache = $cacheFactory('$http');
8968
8955
 
@@ -9807,7 +9794,7 @@ function $HttpProvider() {
9807
9794
  // send the request to the backend
9808
9795
  if (isUndefined(cachedResp)) {
9809
9796
  var xsrfValue = urlIsSameOrigin(config.url)
9810
- ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName]
9797
+ ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
9811
9798
  : undefined;
9812
9799
  if (xsrfValue) {
9813
9800
  reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
@@ -10362,7 +10349,7 @@ function $InterpolateProvider() {
10362
10349
  // all of these properties are undocumented for now
10363
10350
  exp: text, //just for compatibility with regular watchers created via $watch
10364
10351
  expressions: expressions,
10365
- $$watchDelegate: function(scope, listener, objectEquality) {
10352
+ $$watchDelegate: function(scope, listener) {
10366
10353
  var lastValue;
10367
10354
  return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
10368
10355
  var currValue = compute(values);
@@ -10370,7 +10357,7 @@ function $InterpolateProvider() {
10370
10357
  listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
10371
10358
  }
10372
10359
  lastValue = currValue;
10373
- }, objectEquality);
10360
+ });
10374
10361
  }
10375
10362
  });
10376
10363
  }
@@ -10461,6 +10448,7 @@ function $IntervalProvider() {
10461
10448
  * indefinitely.
10462
10449
  * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
10463
10450
  * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
10451
+ * @param {...*=} Pass additional parameters to the executed function.
10464
10452
  * @returns {promise} A promise which will be notified on each iteration.
10465
10453
  *
10466
10454
  * @example
@@ -10554,7 +10542,9 @@ function $IntervalProvider() {
10554
10542
  * </example>
10555
10543
  */
10556
10544
  function interval(fn, delay, count, invokeApply) {
10557
- var setInterval = $window.setInterval,
10545
+ var hasParams = arguments.length > 4,
10546
+ args = hasParams ? sliceArgs(arguments, 4) : [],
10547
+ setInterval = $window.setInterval,
10558
10548
  clearInterval = $window.clearInterval,
10559
10549
  iteration = 0,
10560
10550
  skipApply = (isDefined(invokeApply) && !invokeApply),
@@ -10563,7 +10553,9 @@ function $IntervalProvider() {
10563
10553
 
10564
10554
  count = isDefined(count) ? count : 0;
10565
10555
 
10566
- promise.then(null, null, fn);
10556
+ promise.then(null, null, (!hasParams) ? fn : function() {
10557
+ fn.apply(null, args);
10558
+ });
10567
10559
 
10568
10560
  promise.$$intervalId = setInterval(function tick() {
10569
10561
  deferred.notify(iteration++);
@@ -10667,7 +10659,15 @@ function $LocaleProvider() {
10667
10659
  mediumDate: 'MMM d, y',
10668
10660
  shortDate: 'M/d/yy',
10669
10661
  mediumTime: 'h:mm:ss a',
10670
- shortTime: 'h:mm a'
10662
+ shortTime: 'h:mm a',
10663
+ ERANAMES: [
10664
+ "Before Christ",
10665
+ "Anno Domini"
10666
+ ],
10667
+ ERAS: [
10668
+ "BC",
10669
+ "AD"
10670
+ ]
10671
10671
  },
10672
10672
 
10673
10673
  pluralCat: function(num) {
@@ -11678,6 +11678,7 @@ function $LocationProvider() {
11678
11678
  <button ng-click="$log.warn(message)">warn</button>
11679
11679
  <button ng-click="$log.info(message)">info</button>
11680
11680
  <button ng-click="$log.error(message)">error</button>
11681
+ <button ng-click="$log.debug(message)">debug</button>
11681
11682
  </div>
11682
11683
  </file>
11683
11684
  </example>
@@ -11808,6 +11809,17 @@ function $LogProvider() {
11808
11809
  }];
11809
11810
  }
11810
11811
 
11812
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
11813
+ * Any commits to this file should be reviewed with security in mind. *
11814
+ * Changes to this file can potentially create security vulnerabilities. *
11815
+ * An approval from 2 Core members with history of modifying *
11816
+ * this file is required. *
11817
+ * *
11818
+ * Does the change somehow allow for arbitrary javascript to be executed? *
11819
+ * Or allows for someone to change the prototype of built-in objects? *
11820
+ * Or gives undesired access to variables likes document or window? *
11821
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
11822
+
11811
11823
  var $parseMinErr = minErr('$parse');
11812
11824
 
11813
11825
  // Sandboxing Angular Expressions
@@ -14381,9 +14393,27 @@ function $RootScopeProvider() {
14381
14393
  return TTL;
14382
14394
  };
14383
14395
 
14396
+ function createChildScopeClass(parent) {
14397
+ function ChildScope() {
14398
+ this.$$watchers = this.$$nextSibling =
14399
+ this.$$childHead = this.$$childTail = null;
14400
+ this.$$listeners = {};
14401
+ this.$$listenerCount = {};
14402
+ this.$$watchersCount = 0;
14403
+ this.$id = nextUid();
14404
+ this.$$ChildScope = null;
14405
+ }
14406
+ ChildScope.prototype = parent;
14407
+ return ChildScope;
14408
+ }
14409
+
14384
14410
  this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
14385
14411
  function($injector, $exceptionHandler, $parse, $browser) {
14386
14412
 
14413
+ function destroyChildScope($event) {
14414
+ $event.currentScope.$$destroyed = true;
14415
+ }
14416
+
14387
14417
  /**
14388
14418
  * @ngdoc type
14389
14419
  * @name $rootScope.Scope
@@ -14507,16 +14537,7 @@ function $RootScopeProvider() {
14507
14537
  // Only create a child scope class if somebody asks for one,
14508
14538
  // but cache it to allow the VM to optimize lookups.
14509
14539
  if (!this.$$ChildScope) {
14510
- this.$$ChildScope = function ChildScope() {
14511
- this.$$watchers = this.$$nextSibling =
14512
- this.$$childHead = this.$$childTail = null;
14513
- this.$$listeners = {};
14514
- this.$$listenerCount = {};
14515
- this.$$watchersCount = 0;
14516
- this.$id = nextUid();
14517
- this.$$ChildScope = null;
14518
- };
14519
- this.$$ChildScope.prototype = this;
14540
+ this.$$ChildScope = createChildScopeClass(this);
14520
14541
  }
14521
14542
  child = new this.$$ChildScope();
14522
14543
  }
@@ -14534,13 +14555,9 @@ function $RootScopeProvider() {
14534
14555
  // prototypically. In all other cases, this property needs to be set
14535
14556
  // when the parent scope is destroyed.
14536
14557
  // The listener needs to be added after the parent is set
14537
- if (isolate || parent != this) child.$on('$destroy', destroyChild);
14558
+ if (isolate || parent != this) child.$on('$destroy', destroyChildScope);
14538
14559
 
14539
14560
  return child;
14540
-
14541
- function destroyChild() {
14542
- child.$$destroyed = true;
14543
- }
14544
14561
  },
14545
14562
 
14546
14563
  /**
@@ -15710,6 +15727,17 @@ function $$SanitizeUriProvider() {
15710
15727
  };
15711
15728
  }
15712
15729
 
15730
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
15731
+ * Any commits to this file should be reviewed with security in mind. *
15732
+ * Changes to this file can potentially create security vulnerabilities. *
15733
+ * An approval from 2 Core members with history of modifying *
15734
+ * this file is required. *
15735
+ * *
15736
+ * Does the change somehow allow for arbitrary javascript to be executed? *
15737
+ * Or allows for someone to change the prototype of built-in objects? *
15738
+ * Or gives undesired access to variables likes document or window? *
15739
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15740
+
15713
15741
  var $sceMinErr = minErr('$sce');
15714
15742
 
15715
15743
  var SCE_CONTEXTS = {
@@ -17054,6 +17082,7 @@ function $TimeoutProvider() {
17054
17082
  * @param {number=} [delay=0] Delay in milliseconds.
17055
17083
  * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
17056
17084
  * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
17085
+ * @param {...*=} Pass additional parameters to the executed function.
17057
17086
  * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
17058
17087
  * promise will be resolved with is the return value of the `fn` function.
17059
17088
  *
@@ -17065,14 +17094,15 @@ function $TimeoutProvider() {
17065
17094
  fn = noop;
17066
17095
  }
17067
17096
 
17068
- var skipApply = (isDefined(invokeApply) && !invokeApply),
17097
+ var args = sliceArgs(arguments, 3),
17098
+ skipApply = (isDefined(invokeApply) && !invokeApply),
17069
17099
  deferred = (skipApply ? $$q : $q).defer(),
17070
17100
  promise = deferred.promise,
17071
17101
  timeoutId;
17072
17102
 
17073
17103
  timeoutId = $browser.defer(function() {
17074
17104
  try {
17075
- deferred.resolve(fn());
17105
+ deferred.resolve(fn.apply(null, args));
17076
17106
  } catch (e) {
17077
17107
  deferred.reject(e);
17078
17108
  $exceptionHandler(e);
@@ -17264,6 +17294,60 @@ function $WindowProvider() {
17264
17294
  this.$get = valueFn(window);
17265
17295
  }
17266
17296
 
17297
+ /**
17298
+ * @name $$cookieReader
17299
+ * @requires $document
17300
+ *
17301
+ * @description
17302
+ * This is a private service for reading cookies used by $http and ngCookies
17303
+ *
17304
+ * @return {Object} a key/value map of the current cookies
17305
+ */
17306
+ function $$CookieReader($document) {
17307
+ var rawDocument = $document[0];
17308
+ var lastCookies = {};
17309
+ var lastCookieString = '';
17310
+
17311
+ function safeDecodeURIComponent(str) {
17312
+ try {
17313
+ return decodeURIComponent(str);
17314
+ } catch (e) {
17315
+ return str;
17316
+ }
17317
+ }
17318
+
17319
+ return function() {
17320
+ var cookieArray, cookie, i, index, name;
17321
+
17322
+ if (rawDocument.cookie !== lastCookieString) {
17323
+ lastCookieString = rawDocument.cookie;
17324
+ cookieArray = lastCookieString.split('; ');
17325
+ lastCookies = {};
17326
+
17327
+ for (i = 0; i < cookieArray.length; i++) {
17328
+ cookie = cookieArray[i];
17329
+ index = cookie.indexOf('=');
17330
+ if (index > 0) { //ignore nameless cookies
17331
+ name = safeDecodeURIComponent(cookie.substring(0, index));
17332
+ // the first value that is seen for a cookie is the most
17333
+ // specific one. values for the same cookie name that
17334
+ // follow are for less specific paths.
17335
+ if (lastCookies[name] === undefined) {
17336
+ lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
17337
+ }
17338
+ }
17339
+ }
17340
+ }
17341
+ return lastCookies;
17342
+ };
17343
+ }
17344
+
17345
+ $$CookieReader.$inject = ['$document'];
17346
+
17347
+ function $$CookieReaderProvider() {
17348
+ this.$get = $$CookieReader;
17349
+ }
17350
+
17267
17351
  /* global currencyFilter: true,
17268
17352
  dateFilter: true,
17269
17353
  filterFilter: true,
@@ -17466,6 +17550,9 @@ function $FilterProvider($provide) {
17466
17550
  * - `false|undefined`: A short hand for a function which will look for a substring match in case
17467
17551
  * insensitive way.
17468
17552
  *
17553
+ * Primitive values are converted to strings. Objects are not compared against primitives,
17554
+ * unless they have a custom `toString` method (e.g. `Date` objects).
17555
+ *
17469
17556
  * @example
17470
17557
  <example>
17471
17558
  <file name="index.html">
@@ -17568,6 +17655,10 @@ function filterFilter() {
17568
17655
  };
17569
17656
  }
17570
17657
 
17658
+ function hasCustomToString(obj) {
17659
+ return isFunction(obj.toString) && obj.toString !== Object.prototype.toString;
17660
+ }
17661
+
17571
17662
  // Helper functions for `filterFilter`
17572
17663
  function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
17573
17664
  var shouldMatchPrimitives = isObject(expression) && ('$' in expression);
@@ -17577,8 +17668,8 @@ function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
17577
17668
  comparator = equals;
17578
17669
  } else if (!isFunction(comparator)) {
17579
17670
  comparator = function(actual, expected) {
17580
- if (isObject(actual) || isObject(expected)) {
17581
- // Prevent an object to be considered equal to a string like `'[object'`
17671
+ if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {
17672
+ // Should not compare primitives against objects, unless they have custom `toString` method
17582
17673
  return false;
17583
17674
  }
17584
17675
 
@@ -17599,8 +17690,8 @@ function createPredicateFn(expression, comparator, matchAgainstAnyProp) {
17599
17690
  }
17600
17691
 
17601
17692
  function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {
17602
- var actualType = typeof actual;
17603
- var expectedType = typeof expected;
17693
+ var actualType = (actual !== null) ? typeof actual : 'null';
17694
+ var expectedType = (expected !== null) ? typeof expected : 'null';
17604
17695
 
17605
17696
  if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
17606
17697
  return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);
@@ -17625,7 +17716,7 @@ function deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatc
17625
17716
  } else if (expectedType === 'object') {
17626
17717
  for (key in expected) {
17627
17718
  var expectedVal = expected[key];
17628
- if (isFunction(expectedVal)) {
17719
+ if (isFunction(expectedVal) || isUndefined(expectedVal)) {
17629
17720
  continue;
17630
17721
  }
17631
17722
 
@@ -17949,6 +18040,14 @@ function ampmGetter(date, formats) {
17949
18040
  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
17950
18041
  }
17951
18042
 
18043
+ function eraGetter(date, formats) {
18044
+ return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
18045
+ }
18046
+
18047
+ function longEraGetter(date, formats) {
18048
+ return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
18049
+ }
18050
+
17952
18051
  var DATE_FORMATS = {
17953
18052
  yyyy: dateGetter('FullYear', 4),
17954
18053
  yy: dateGetter('FullYear', 2, 0, true),
@@ -17975,10 +18074,14 @@ var DATE_FORMATS = {
17975
18074
  a: ampmGetter,
17976
18075
  Z: timeZoneGetter,
17977
18076
  ww: weekGetter(2),
17978
- w: weekGetter(1)
18077
+ w: weekGetter(1),
18078
+ G: eraGetter,
18079
+ GG: eraGetter,
18080
+ GGG: eraGetter,
18081
+ GGGG: longEraGetter
17979
18082
  };
17980
18083
 
17981
- var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|w+))(.*)/,
18084
+ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
17982
18085
  NUMBER_STRING = /^\-?\d+$/;
17983
18086
 
17984
18087
  /**
@@ -18015,6 +18118,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d
18015
18118
  * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
18016
18119
  * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
18017
18120
  * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
18121
+ * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
18122
+ * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
18018
18123
  *
18019
18124
  * `format` string can also be one of the following predefined
18020
18125
  * {@link guide/i18n localizable formats}:
@@ -18135,12 +18240,8 @@ function dateFilter($locale) {
18135
18240
 
18136
18241
  var dateTimezoneOffset = date.getTimezoneOffset();
18137
18242
  if (timezone) {
18138
- var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
18139
- if (!isNaN(requestedTimezoneOffset)) {
18140
- date = new Date(date.getTime());
18141
- date.setMinutes(date.getMinutes() + dateTimezoneOffset - requestedTimezoneOffset);
18142
- dateTimezoneOffset = requestedTimezoneOffset;
18143
- }
18243
+ dateTimezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset());
18244
+ date = convertTimezoneToLocal(date, timezone, true);
18144
18245
  }
18145
18246
  forEach(parts, function(value) {
18146
18247
  fn = DATE_FORMATS[value];
@@ -18365,6 +18466,43 @@ function limitToFilter() {
18365
18466
  * @param {boolean=} reverse Reverse the order of the array.
18366
18467
  * @returns {Array} Sorted copy of the source array.
18367
18468
  *
18469
+ *
18470
+ * @example
18471
+ * The example below demonstrates a simple ngRepeat, where the data is sorted
18472
+ * by age in descending order (predicate is set to `'-age'`).
18473
+ * `reverse` is not set, which means it defaults to `false`.
18474
+ <example module="orderByExample">
18475
+ <file name="index.html">
18476
+ <script>
18477
+ angular.module('orderByExample', [])
18478
+ .controller('ExampleController', ['$scope', function($scope) {
18479
+ $scope.friends =
18480
+ [{name:'John', phone:'555-1212', age:10},
18481
+ {name:'Mary', phone:'555-9876', age:19},
18482
+ {name:'Mike', phone:'555-4321', age:21},
18483
+ {name:'Adam', phone:'555-5678', age:35},
18484
+ {name:'Julie', phone:'555-8765', age:29}];
18485
+ }]);
18486
+ </script>
18487
+ <div ng-controller="ExampleController">
18488
+ <table class="friend">
18489
+ <tr>
18490
+ <th>Name</th>
18491
+ <th>Phone Number</th>
18492
+ <th>Age</th>
18493
+ </tr>
18494
+ <tr ng-repeat="friend in friends | orderBy:'-age'">
18495
+ <td>{{friend.name}}</td>
18496
+ <td>{{friend.phone}}</td>
18497
+ <td>{{friend.age}}</td>
18498
+ </tr>
18499
+ </table>
18500
+ </div>
18501
+ </file>
18502
+ </example>
18503
+ *
18504
+ * The predicate and reverse parameters can be controlled dynamically through scope properties,
18505
+ * as shown in the next example.
18368
18506
  * @example
18369
18507
  <example module="orderByExample">
18370
18508
  <file name="index.html">
@@ -18747,6 +18885,7 @@ var htmlAnchorDirective = valueFn({
18747
18885
  * but not on older IEs:
18748
18886
  *
18749
18887
  * ```html
18888
+ * <!-- See below for an example of ng-disabled being used correctly -->
18750
18889
  * <div ng-init="isDisabled = false">
18751
18890
  * <button disabled="{{isDisabled}}">Disabled</button>
18752
18891
  * </div>
@@ -19334,7 +19473,7 @@ function FormController(element, attrs, $scope, $animate, $interpolate) {
19334
19473
  *
19335
19474
  * # Alias: {@link ng.directive:ngForm `ngForm`}
19336
19475
  *
19337
- * In Angular forms can be nested. This means that the outer form is valid when all of the child
19476
+ * In Angular, forms can be nested. This means that the outer form is valid when all of the child
19338
19477
  * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
19339
19478
  * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
19340
19479
  * `<form>` but can be nested. This allows you to have nested forms, which is very useful when
@@ -19472,10 +19611,12 @@ var formDirectiveFactory = function(isNgForm) {
19472
19611
  name: 'form',
19473
19612
  restrict: isNgForm ? 'EAC' : 'E',
19474
19613
  controller: FormController,
19475
- compile: function ngFormCompile(formElement) {
19614
+ compile: function ngFormCompile(formElement, attr) {
19476
19615
  // Setup initial state of the control
19477
19616
  formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
19478
19617
 
19618
+ var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
19619
+
19479
19620
  return {
19480
19621
  pre: function ngFormPreLink(scope, formElement, attr, controller) {
19481
19622
  // if `action` attr is not present on the form, prevent the default action (submission)
@@ -19506,23 +19647,21 @@ var formDirectiveFactory = function(isNgForm) {
19506
19647
  });
19507
19648
  }
19508
19649
 
19509
- var parentFormCtrl = controller.$$parentForm,
19510
- alias = controller.$name;
19511
-
19512
- if (alias) {
19513
- setter(scope, alias, controller, alias);
19514
- attr.$observe(attr.name ? 'name' : 'ngForm', function(newValue) {
19515
- if (alias === newValue) return;
19516
- setter(scope, alias, undefined, alias);
19517
- alias = newValue;
19518
- setter(scope, alias, controller, alias);
19519
- parentFormCtrl.$$renameControl(controller, alias);
19650
+ var parentFormCtrl = controller.$$parentForm;
19651
+
19652
+ if (nameAttr) {
19653
+ setter(scope, controller.$name, controller, controller.$name);
19654
+ attr.$observe(nameAttr, function(newValue) {
19655
+ if (controller.$name === newValue) return;
19656
+ setter(scope, controller.$name, undefined, controller.$name);
19657
+ parentFormCtrl.$$renameControl(controller, newValue);
19658
+ setter(scope, controller.$name, controller, controller.$name);
19520
19659
  });
19521
19660
  }
19522
19661
  formElement.on('$destroy', function() {
19523
19662
  parentFormCtrl.$removeControl(controller);
19524
- if (alias) {
19525
- setter(scope, alias, undefined, alias);
19663
+ if (nameAttr) {
19664
+ setter(scope, attr[nameAttr], undefined, controller.$name);
19526
19665
  }
19527
19666
  extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
19528
19667
  });
@@ -20694,8 +20833,8 @@ function createDateInputType(type, regexp, parseDate, format) {
20694
20833
  // parser/formatter in the processing chain so that the model
20695
20834
  // contains some different data format!
20696
20835
  var parsedDate = parseDate(value, previousDate);
20697
- if (timezone === 'UTC') {
20698
- parsedDate.setMinutes(parsedDate.getMinutes() - parsedDate.getTimezoneOffset());
20836
+ if (timezone) {
20837
+ parsedDate = convertTimezoneToLocal(parsedDate, timezone);
20699
20838
  }
20700
20839
  return parsedDate;
20701
20840
  }
@@ -20708,9 +20847,8 @@ function createDateInputType(type, regexp, parseDate, format) {
20708
20847
  }
20709
20848
  if (isValidDate(value)) {
20710
20849
  previousDate = value;
20711
- if (previousDate && timezone === 'UTC') {
20712
- var timezoneOffset = 60000 * previousDate.getTimezoneOffset();
20713
- previousDate = new Date(previousDate.getTime() + timezoneOffset);
20850
+ if (previousDate && timezone) {
20851
+ previousDate = convertTimezoneToLocal(previousDate, timezone, true);
20714
20852
  }
20715
20853
  return $filter('date')(value, format, timezone);
20716
20854
  } else {
@@ -23182,7 +23320,7 @@ var ngIncludeFillContentDirective = ['$compile',
23182
23320
  * The `ngInit` directive allows you to evaluate an expression in the
23183
23321
  * current scope.
23184
23322
  *
23185
- * <div class="alert alert-error">
23323
+ * <div class="alert alert-danger">
23186
23324
  * The only appropriate use of `ngInit` is for aliasing special properties of
23187
23325
  * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you
23188
23326
  * should use {@link guide/controller controllers} rather than `ngInit`
@@ -23495,8 +23633,8 @@ is set to `true`. The parse error is stored in `ngModel.$error.parse`.
23495
23633
  * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
23496
23634
  * collaborate together to achieve the desired result.
23497
23635
  *
23498
- * Note that `contenteditable` is an HTML5 attribute, which tells the browser to let the element
23499
- * contents be edited in place by the user. This will not work on older browsers.
23636
+ * `contenteditable` is an HTML5 attribute, which tells the browser to let the element
23637
+ * contents be edited in place by the user.
23500
23638
  *
23501
23639
  * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}
23502
23640
  * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`).
@@ -24459,8 +24597,10 @@ var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
24459
24597
  * - `getterSetter`: boolean value which determines whether or not to treat functions bound to
24460
24598
  `ngModel` as getters/setters.
24461
24599
  * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
24462
- * `<input type="date">`, `<input type="time">`, ... . Right now, the only supported value is `'UTC'`,
24463
- * otherwise the default timezone of the browser will be used.
24600
+ * `<input type="date">`, `<input type="time">`, ... . It understands UTC/GMT and the
24601
+ * continental US time zone abbreviations, but for general use, use a time zone offset, for
24602
+ * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
24603
+ * If not specified, the timezone of the browser will be used.
24464
24604
  *
24465
24605
  * @example
24466
24606
 
@@ -25068,6 +25208,11 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25068
25208
  selectValueMap: selectValueMap,
25069
25209
  getOptionFromViewValue: function(value) {
25070
25210
  return selectValueMap[getTrackByValue(value, getLocals(value))];
25211
+ },
25212
+ getViewValueFromOption: function(option) {
25213
+ // If the viewValue could be an object that may be mutated by the application,
25214
+ // we need to make a copy and not return the reference to the value on the option.
25215
+ return trackBy ? angular.copy(option.viewValue) : option.viewValue;
25071
25216
  }
25072
25217
  };
25073
25218
  }
@@ -25161,7 +25306,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25161
25306
  if (selectedOption && !selectedOption.disabled) {
25162
25307
  removeEmptyOption();
25163
25308
  removeUnknownOption();
25164
- return selectedOption.viewValue;
25309
+ return options.getViewValueFromOption(selectedOption);
25165
25310
  }
25166
25311
  return null;
25167
25312
  };
@@ -25195,7 +25340,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25195
25340
 
25196
25341
  forEach(selectedValues, function(value) {
25197
25342
  var option = options.selectValueMap[value];
25198
- if (!option.disabled) selections.push(option.viewValue);
25343
+ if (!option.disabled) selections.push(options.getViewValueFromOption(option));
25199
25344
  });
25200
25345
 
25201
25346
  return selections;
@@ -25226,6 +25371,10 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
25226
25371
  // We will re-render the option elements if the option values or labels change
25227
25372
  scope.$watchCollection(ngOptions.getWatchables, updateOptions);
25228
25373
 
25374
+ // We also need to watch to see if the internals of the model changes, since
25375
+ // ngModel only watches for object identity change
25376
+ scope.$watch(attr.ngModel, function() { ngModelCtrl.$render(); }, true);
25377
+
25229
25378
  // ------------------------------------------------------------------ //
25230
25379
 
25231
25380
 
@@ -25557,7 +25706,6 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
25557
25706
  IS_WHEN = /^when(Minus)?(.+)$/;
25558
25707
 
25559
25708
  return {
25560
- restrict: 'EA',
25561
25709
  link: function(scope, element, attr) {
25562
25710
  var numberExp = attr.count,
25563
25711
  whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs