angularjs-rails 1.6.8 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.6.8
3
- * (c) 2010-2017 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.8.0
3
+ * (c) 2010-2020 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular) {'use strict';
@@ -19,8 +19,8 @@
19
19
  *
20
20
  * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following
21
21
  * directives are supported:
22
- * `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`,
23
- * `ngDblClick`, and `ngMessages`.
22
+ * `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`,
23
+ * `ngClick`, `ngDblClick`, and `ngMessages`.
24
24
  *
25
25
  * Below is a more detailed breakdown of the attributes handled by ngAria:
26
26
  *
@@ -51,13 +51,19 @@
51
51
  * <md-checkbox ng-disabled="disabled" aria-disabled="true">
52
52
  * ```
53
53
  *
54
- * ## Disabling Attributes
55
- * It's possible to disable individual attributes added by ngAria with the
54
+ * ## Disabling Specific Attributes
55
+ * It is possible to disable individual attributes added by ngAria with the
56
56
  * {@link ngAria.$ariaProvider#config config} method. For more details, see the
57
57
  * {@link guide/accessibility Developer Guide}.
58
+ *
59
+ * ## Disabling `ngAria` on Specific Elements
60
+ * It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable`
61
+ * attribute on it. Note that only the element itself (and not its child elements) will be ignored.
58
62
  */
63
+ var ARIA_DISABLE_ATTR = 'ngAriaDisable';
64
+
59
65
  var ngAriaModule = angular.module('ngAria', ['ng']).
60
- info({ angularVersion: '1.6.8' }).
66
+ info({ angularVersion: '1.8.0' }).
61
67
  provider('$aria', $AriaProvider);
62
68
 
63
69
  /**
@@ -137,6 +143,8 @@ function $AriaProvider() {
137
143
 
138
144
  function watchExpr(attrName, ariaAttr, nodeBlackList, negate) {
139
145
  return function(scope, elem, attr) {
146
+ if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
147
+
140
148
  var ariaCamelName = attr.$normalize(ariaAttr);
141
149
  if (config[ariaCamelName] && !isNodeOneOf(elem, nodeBlackList) && !attr[ariaCamelName]) {
142
150
  scope.$watch(attr[attrName], function(boolVal) {
@@ -152,7 +160,6 @@ function $AriaProvider() {
152
160
  * @name $aria
153
161
  *
154
162
  * @description
155
- * @priority 200
156
163
  *
157
164
  * The $aria service contains helper methods for applying common
158
165
  * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
@@ -229,7 +236,10 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
229
236
  .directive('ngModel', ['$aria', function($aria) {
230
237
 
231
238
  function shouldAttachAttr(attr, normalizedAttr, elem, allowBlacklistEls) {
232
- return $aria.config(normalizedAttr) && !elem.attr(attr) && (allowBlacklistEls || !isNodeOneOf(elem, nodeBlackList));
239
+ return $aria.config(normalizedAttr) &&
240
+ !elem.attr(attr) &&
241
+ (allowBlacklistEls || !isNodeOneOf(elem, nodeBlackList)) &&
242
+ (elem.attr('type') !== 'hidden' || elem[0].nodeName !== 'INPUT');
233
243
  }
234
244
 
235
245
  function shouldAttachRole(role, elem) {
@@ -253,6 +263,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
253
263
  require: 'ngModel',
254
264
  priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value
255
265
  compile: function(elem, attr) {
266
+ if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
267
+
256
268
  var shape = getShape(attr, elem);
257
269
 
258
270
  return {
@@ -349,6 +361,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
349
361
  restrict: 'A',
350
362
  require: '?ngMessages',
351
363
  link: function(scope, elem, attr, ngMessages) {
364
+ if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
365
+
352
366
  if (!elem.attr('aria-live')) {
353
367
  elem.attr('aria-live', 'assertive');
354
368
  }
@@ -359,6 +373,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
359
373
  return {
360
374
  restrict: 'A',
361
375
  compile: function(elem, attr) {
376
+ if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
377
+
362
378
  var fn = $parse(attr.ngClick);
363
379
  return function(scope, elem, attr) {
364
380
 
@@ -375,7 +391,14 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
375
391
  if ($aria.config('bindKeydown') && !attr.ngKeydown && !attr.ngKeypress && !attr.ngKeyup) {
376
392
  elem.on('keydown', function(event) {
377
393
  var keyCode = event.which || event.keyCode;
378
- if (keyCode === 32 || keyCode === 13) {
394
+
395
+ if (keyCode === 13 || keyCode === 32) {
396
+ // If the event is triggered on a non-interactive element ...
397
+ if (nodeBlackList.indexOf(event.target.nodeName) === -1 && !event.target.isContentEditable) {
398
+ // ... prevent the default browser behavior (e.g. scrolling when pressing spacebar)
399
+ // See https://github.com/angular/angular.js/issues/16664
400
+ event.preventDefault();
401
+ }
379
402
  scope.$apply(callback);
380
403
  }
381
404
 
@@ -391,6 +414,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
391
414
  }])
392
415
  .directive('ngDblclick', ['$aria', function($aria) {
393
416
  return function(scope, elem, attr) {
417
+ if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return;
418
+
394
419
  if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nodeBlackList)) {
395
420
  elem.attr('tabindex', 0);
396
421
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.6.8
3
- * (c) 2010-2017 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.8.0
3
+ * (c) 2010-2020 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular) {'use strict';
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
  angular.module('ngCookies', ['ng']).
20
- info({ angularVersion: '1.6.8' }).
20
+ info({ angularVersion: '1.8.0' }).
21
21
  /**
22
22
  * @ngdoc provider
23
23
  * @name $cookiesProvider
@@ -43,6 +43,10 @@ angular.module('ngCookies', ['ng']).
43
43
  * or a Date object indicating the exact date/time this cookie will expire.
44
44
  * - **secure** - `{boolean}` - If `true`, then the cookie will only be available through a
45
45
  * secured connection.
46
+ * - **samesite** - `{string}` - prevents the browser from sending the cookie along with cross-site requests.
47
+ * Accepts the values `lax` and `strict`. See the [OWASP Wiki](https://www.owasp.org/index.php/SameSite)
48
+ * for more info. Note that as of May 2018, not all browsers support `SameSite`,
49
+ * so it cannot be used as a single measure against Cross-Site-Request-Forgery (CSRF) attacks.
46
50
  *
47
51
  * Note: By default, the address that appears in your `<base>` tag will be used as the path.
48
52
  * This is important so that cookies will be visible for all routes when html5mode is enabled.
@@ -72,7 +76,7 @@ angular.module('ngCookies', ['ng']).
72
76
  * Provides read/write access to browser's cookies.
73
77
  *
74
78
  * <div class="alert alert-info">
75
- * Up until Angular 1.3, `$cookies` exposed properties that represented the
79
+ * Up until AngularJS 1.3, `$cookies` exposed properties that represented the
76
80
  * current browser cookie values. In version 1.4, this behavior has changed, and
77
81
  * `$cookies` now provides a standard api of getters, setters etc.
78
82
  * </div>
@@ -185,84 +189,6 @@ angular.module('ngCookies', ['ng']).
185
189
  }];
186
190
  }]);
187
191
 
188
- angular.module('ngCookies').
189
- /**
190
- * @ngdoc service
191
- * @name $cookieStore
192
- * @deprecated
193
- * sinceVersion="v1.4.0"
194
- * Please use the {@link ngCookies.$cookies `$cookies`} service instead.
195
- *
196
- * @requires $cookies
197
- *
198
- * @description
199
- * Provides a key-value (string-object) storage, that is backed by session cookies.
200
- * Objects put or retrieved from this storage are automatically serialized or
201
- * deserialized by angular's toJson/fromJson.
202
- *
203
- * Requires the {@link ngCookies `ngCookies`} module to be installed.
204
- *
205
- * @example
206
- *
207
- * ```js
208
- * angular.module('cookieStoreExample', ['ngCookies'])
209
- * .controller('ExampleController', ['$cookieStore', function($cookieStore) {
210
- * // Put cookie
211
- * $cookieStore.put('myFavorite','oatmeal');
212
- * // Get cookie
213
- * var favoriteCookie = $cookieStore.get('myFavorite');
214
- * // Removing a cookie
215
- * $cookieStore.remove('myFavorite');
216
- * }]);
217
- * ```
218
- */
219
- factory('$cookieStore', ['$cookies', function($cookies) {
220
-
221
- return {
222
- /**
223
- * @ngdoc method
224
- * @name $cookieStore#get
225
- *
226
- * @description
227
- * Returns the value of given cookie key
228
- *
229
- * @param {string} key Id to use for lookup.
230
- * @returns {Object} Deserialized cookie value, undefined if the cookie does not exist.
231
- */
232
- get: function(key) {
233
- return $cookies.getObject(key);
234
- },
235
-
236
- /**
237
- * @ngdoc method
238
- * @name $cookieStore#put
239
- *
240
- * @description
241
- * Sets a value for given cookie key
242
- *
243
- * @param {string} key Id for the `value`.
244
- * @param {Object} value Value to be stored.
245
- */
246
- put: function(key, value) {
247
- $cookies.putObject(key, value);
248
- },
249
-
250
- /**
251
- * @ngdoc method
252
- * @name $cookieStore#remove
253
- *
254
- * @description
255
- * Remove given cookie
256
- *
257
- * @param {string} key Id of the key-value pair to delete.
258
- */
259
- remove: function(key) {
260
- $cookies.remove(key);
261
- }
262
- };
263
-
264
- }]);
265
-
266
192
  /**
267
193
  * @name $$cookieWriter
268
194
  * @requires $document
@@ -296,6 +222,7 @@ function $$CookieWriter($document, $log, $browser) {
296
222
  str += options.domain ? ';domain=' + options.domain : '';
297
223
  str += expires ? ';expires=' + expires.toUTCString() : '';
298
224
  str += options.secure ? ';secure' : '';
225
+ str += options.samesite ? ';samesite=' + options.samesite : '';
299
226
 
300
227
  // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
301
228
  // - 300 cookies
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.6.8
3
- * (c) 2010-2017 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.8.0
3
+ * (c) 2010-2020 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
 
@@ -76,7 +76,8 @@ function toDebugString(obj, maxDepth) {
76
76
  */
77
77
 
78
78
  var minErrConfig = {
79
- objectMaxDepth: 5
79
+ objectMaxDepth: 5,
80
+ urlErrorParamsEnabled: true
80
81
  };
81
82
 
82
83
  /**
@@ -99,12 +100,21 @@ var minErrConfig = {
99
100
  * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
100
101
  * non-positive or non-numeric value, removes the max depth limit.
101
102
  * Default: 5
103
+ *
104
+ * * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will
105
+ * contain the parameters of the thrown error. Disabling the parameters can be useful if the
106
+ * generated error url is very long.
107
+ *
108
+ * Default: true. When used without argument, it returns the current value.
102
109
  */
103
110
  function errorHandlingConfig(config) {
104
111
  if (isObject(config)) {
105
112
  if (isDefined(config.objectMaxDepth)) {
106
113
  minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
107
114
  }
115
+ if (isDefined(config.urlErrorParamsEnabled) && isBoolean(config.urlErrorParamsEnabled)) {
116
+ minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled;
117
+ }
108
118
  } else {
109
119
  return minErrConfig;
110
120
  }
@@ -119,11 +129,12 @@ function isValidObjectMaxDepth(maxDepth) {
119
129
  return isNumber(maxDepth) && maxDepth > 0;
120
130
  }
121
131
 
132
+
122
133
  /**
123
134
  * @description
124
135
  *
125
136
  * This object provides a utility for producing rich Error messages within
126
- * Angular. It can be called as follows:
137
+ * AngularJS. It can be called as follows:
127
138
  *
128
139
  * var exampleMinErr = minErr('example');
129
140
  * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
@@ -140,7 +151,7 @@ function isValidObjectMaxDepth(maxDepth) {
140
151
  * Since data will be parsed statically during a build step, some restrictions
141
152
  * are applied with respect to how minErr instances are created and called.
142
153
  * Instances should have names of the form namespaceMinErr for a minErr created
143
- * using minErr('namespace') . Error codes, namespaces and template strings
154
+ * using minErr('namespace'). Error codes, namespaces and template strings
144
155
  * should all be static strings, not variables or general expressions.
145
156
  *
146
157
  * @param {string} module The namespace to use for the new minErr instance.
@@ -151,6 +162,11 @@ function isValidObjectMaxDepth(maxDepth) {
151
162
 
152
163
  function minErr(module, ErrorConstructor) {
153
164
  ErrorConstructor = ErrorConstructor || Error;
165
+
166
+ var url = 'https://errors.angularjs.org/1.8.0/';
167
+ var regex = url.replace('.', '\\.') + '[\\s\\S]*';
168
+ var errRegExp = new RegExp(regex, 'g');
169
+
154
170
  return function() {
155
171
  var code = arguments[0],
156
172
  template = arguments[1],
@@ -160,21 +176,27 @@ function minErr(module, ErrorConstructor) {
160
176
  }),
161
177
  paramPrefix, i;
162
178
 
179
+ // A minErr message has two parts: the message itself and the url that contains the
180
+ // encoded message.
181
+ // The message's parameters can contain other error messages which also include error urls.
182
+ // To prevent the messages from getting too long, we strip the error urls from the parameters.
183
+
163
184
  message += template.replace(/\{\d+\}/g, function(match) {
164
185
  var index = +match.slice(1, -1);
165
186
 
166
187
  if (index < templateArgs.length) {
167
- return templateArgs[index];
188
+ return templateArgs[index].replace(errRegExp, '');
168
189
  }
169
190
 
170
191
  return match;
171
192
  });
172
193
 
173
- message += '\nhttp://errors.angularjs.org/1.6.8/' +
174
- (module ? module + '/' : '') + code;
194
+ message += '\n' + url + (module ? module + '/' : '') + code;
175
195
 
176
- for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
177
- message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
196
+ if (minErrConfig.urlErrorParamsEnabled) {
197
+ for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
198
+ message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
199
+ }
178
200
  }
179
201
 
180
202
  return new ErrorConstructor(message);
@@ -187,7 +209,7 @@ function minErr(module, ErrorConstructor) {
187
209
  * @module ng
188
210
  * @description
189
211
  *
190
- * Interface for configuring angular {@link angular.module modules}.
212
+ * Interface for configuring AngularJS {@link angular.module modules}.
191
213
  */
192
214
 
193
215
  function setupModuleLoader(window) {
@@ -214,9 +236,9 @@ function setupModuleLoader(window) {
214
236
  * @module ng
215
237
  * @description
216
238
  *
217
- * The `angular.module` is a global place for creating, registering and retrieving Angular
239
+ * The `angular.module` is a global place for creating, registering and retrieving AngularJS
218
240
  * modules.
219
- * All modules (angular core or 3rd party) that should be available to an application must be
241
+ * All modules (AngularJS core or 3rd party) that should be available to an application must be
220
242
  * registered using this mechanism.
221
243
  *
222
244
  * Passing one argument retrieves an existing {@link angular.Module},
@@ -466,13 +488,13 @@ function setupModuleLoader(window) {
466
488
  * @ngdoc method
467
489
  * @name angular.Module#filter
468
490
  * @module ng
469
- * @param {string} name Filter name - this must be a valid angular expression identifier
491
+ * @param {string} name Filter name - this must be a valid AngularJS expression identifier
470
492
  * @param {Function} filterFactory Factory function for creating new instance of filter.
471
493
  * @description
472
494
  * See {@link ng.$filterProvider#register $filterProvider.register()}.
473
495
  *
474
496
  * <div class="alert alert-warning">
475
- * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
497
+ * **Note:** Filter names must be valid AngularJS {@link expression} identifiers, such as `uppercase` or `orderBy`.
476
498
  * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
477
499
  * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
478
500
  * (`myapp_subsection_filterx`).
@@ -509,7 +531,8 @@ function setupModuleLoader(window) {
509
531
  * @ngdoc method
510
532
  * @name angular.Module#component
511
533
  * @module ng
512
- * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
534
+ * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
535
+ * or an object map of components where the keys are the names and the values are the component definition objects.
513
536
  * @param {Object} options Component definition object (a simplified
514
537
  * {@link ng.$compile#directive-definition-object directive definition object})
515
538
  *
@@ -525,7 +548,13 @@ function setupModuleLoader(window) {
525
548
  * @param {Function} configFn Execute this function on module load. Useful for service
526
549
  * configuration.
527
550
  * @description
528
- * Use this method to register work which needs to be performed on module loading.
551
+ * Use this method to configure services by injecting their
552
+ * {@link angular.Module#provider `providers`}, e.g. for adding routes to the
553
+ * {@link ngRoute.$routeProvider $routeProvider}.
554
+ *
555
+ * Note that you can only inject {@link angular.Module#provider `providers`} and
556
+ * {@link angular.Module#constant `constants`} into this function.
557
+ *
529
558
  * For more about how to configure services, see
530
559
  * {@link providers#provider-recipe Provider Recipe}.
531
560
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.6.8
3
- * (c) 2010-2017 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.8.0
3
+ * (c) 2010-2020 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular) {'use strict';
@@ -725,7 +725,7 @@ MessageFormatParser.prototype.ruleEndMustache = function ruleEndMustache() {
725
725
  // day), then the result *has* to be a string and those rules would have already set
726
726
  // this.parsedFn. If there was no MessageFormat extension, then there is no requirement to
727
727
  // stringify the result and parsedFn isn't set. We set it here. While we could have set it
728
- // unconditionally when exiting the Angular expression, I intend for us to not just replace
728
+ // unconditionally when exiting the AngularJS expression, I intend for us to not just replace
729
729
  // $interpolate, but also to replace $parse in a future version (so ng-bind can work), and in
730
730
  // such a case we do not want to unnecessarily stringify something if it's not going to be used
731
731
  // in a string context.
@@ -769,7 +769,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
769
769
  var position;
770
770
  if (match == null) {
771
771
  if (this.angularOperatorStack.length === 0) {
772
- // This is the end of the Angular expression so this is actually a
772
+ // This is the end of the AngularJS expression so this is actually a
773
773
  // success. Note that when inside an interpolation, this means we even
774
774
  // consumed the closing interpolation symbols if they were curlies. This
775
775
  // is NOT an error at this point but will become an error further up the
@@ -785,7 +785,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
785
785
  }
786
786
  var innermostOperator = this.angularOperatorStack[0];
787
787
  throw $interpolateMinErr('badexpr',
788
- 'Unexpected end of Angular expression. Expecting operator “{0}” at the end of the text “{1}”',
788
+ 'Unexpected end of AngularJS expression. Expecting operator “{0}” at the end of the text “{1}”',
789
789
  this.getEndOperator(innermostOperator), this.text);
790
790
  }
791
791
  var operator = match[0];
@@ -860,7 +860,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
860
860
  *
861
861
  * ## What is ngMessageFormat?
862
862
  *
863
- * The ngMessageFormat module extends the Angular {@link ng.$interpolate `$interpolate`} service
863
+ * The ngMessageFormat module extends the AngularJS {@link ng.$interpolate `$interpolate`} service
864
864
  * with a syntax for handling pluralization and gender specific messages, which is based on the
865
865
  * [ICU MessageFormat syntax][ICU].
866
866
  *
@@ -1055,10 +1055,10 @@ var noop;
1055
1055
  var toJson;
1056
1056
  var $$stringify;
1057
1057
 
1058
- var module = window['angular']['module']('ngMessageFormat', ['ng']);
1059
- module['info']({ 'angularVersion': '1.6.8' });
1060
- module['factory']('$$messageFormat', $$MessageFormatFactory);
1061
- module['config'](['$provide', function($provide) {
1058
+ var ngModule = window['angular']['module']('ngMessageFormat', ['ng']);
1059
+ ngModule['info']({ 'angularVersion': '1.8.0' });
1060
+ ngModule['factory']('$$messageFormat', $$MessageFormatFactory);
1061
+ ngModule['config'](['$provide', function($provide) {
1062
1062
  $interpolateMinErr = window['angular']['$interpolateMinErr'];
1063
1063
  isFunction = window['angular']['isFunction'];
1064
1064
  noop = window['angular']['noop'];