angular-gem 1.2.15 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.15
2
+ * @license AngularJS v1.2.16
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.15
2
+ * @license AngularJS v1.2.16
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -68,7 +68,7 @@ function minErr(module) {
68
68
  return match;
69
69
  });
70
70
 
71
- message = message + '\nhttp://errors.angularjs.org/1.2.15/' +
71
+ message = message + '\nhttp://errors.angularjs.org/1.2.16/' +
72
72
  (module ? module + '/' : '') + code;
73
73
  for (i = 2; i < arguments.length; i++) {
74
74
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
@@ -1355,7 +1355,7 @@ function angularInit(element, bootstrap) {
1355
1355
  * </file>
1356
1356
  * </example>
1357
1357
  *
1358
- * @param {Element} element DOM element which is the root of angular application.
1358
+ * @param {DOMElement} element DOM element which is the root of angular application.
1359
1359
  * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
1360
1360
  * Each item in the array should be the name of a predefined module or a (DI annotated)
1361
1361
  * function that will be invoked by the injector as a run block.
@@ -1589,8 +1589,8 @@ function setupModuleLoader(window) {
1589
1589
  * {@link angular.bootstrap} to simplify this process for you.
1590
1590
  *
1591
1591
  * @param {!string} name The name of the module to create or retrieve.
1592
- * @param {Array.<string>=} requires If specified then new module is being created. If
1593
- * unspecified then the module is being retrieved for further configuration.
1592
+ <<<<<* @param {!Array.<string>=} requires If specified then new module is being created. If
1593
+ >>>>>* unspecified then the module is being retrieved for further configuration.
1594
1594
  * @param {Function} configFn Optional configuration function for the module. Same as
1595
1595
  * {@link angular.Module#config Module#config()}.
1596
1596
  * @returns {module} new module with the {@link angular.Module} api.
@@ -1919,11 +1919,11 @@ function setupModuleLoader(window) {
1919
1919
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1920
1920
  */
1921
1921
  var version = {
1922
- full: '1.2.15', // all of these placeholder strings will be replaced by grunt's
1922
+ full: '1.2.16', // all of these placeholder strings will be replaced by grunt's
1923
1923
  major: 1, // package task
1924
1924
  minor: 2,
1925
- dot: 15,
1926
- codeName: 'beer-underestimating'
1925
+ dot: 16,
1926
+ codeName: 'badger-enumeration'
1927
1927
  };
1928
1928
 
1929
1929
 
@@ -2226,6 +2226,75 @@ function jqLitePatchJQueryRemove(name, dispatchThis, filterElems, getterIfNoArgu
2226
2226
  }
2227
2227
  }
2228
2228
 
2229
+ var SINGLE_TAG_REGEXP = /^<(\w+)\s*\/?>(?:<\/\1>|)$/;
2230
+ var HTML_REGEXP = /<|&#?\w+;/;
2231
+ var TAG_NAME_REGEXP = /<([\w:]+)/;
2232
+ var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;
2233
+
2234
+ var wrapMap = {
2235
+ 'option': [1, '<select multiple="multiple">', '</select>'],
2236
+
2237
+ 'thead': [1, '<table>', '</table>'],
2238
+ 'col': [2, '<table><colgroup>', '</colgroup></table>'],
2239
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
2240
+ 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
2241
+ '_default': [0, "", ""]
2242
+ };
2243
+
2244
+ wrapMap.optgroup = wrapMap.option;
2245
+ wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
2246
+ wrapMap.th = wrapMap.td;
2247
+
2248
+ function jqLiteIsTextNode(html) {
2249
+ return !HTML_REGEXP.test(html);
2250
+ }
2251
+
2252
+ function jqLiteBuildFragment(html, context) {
2253
+ var elem, tmp, tag, wrap,
2254
+ fragment = context.createDocumentFragment(),
2255
+ nodes = [], i, j, jj;
2256
+
2257
+ if (jqLiteIsTextNode(html)) {
2258
+ // Convert non-html into a text node
2259
+ nodes.push(context.createTextNode(html));
2260
+ } else {
2261
+ tmp = fragment.appendChild(context.createElement('div'));
2262
+ // Convert html into DOM nodes
2263
+ tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
2264
+ wrap = wrapMap[tag] || wrapMap._default;
2265
+ tmp.innerHTML = '<div>&#160;</div>' +
2266
+ wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
2267
+ tmp.removeChild(tmp.firstChild);
2268
+
2269
+ // Descend through wrappers to the right content
2270
+ i = wrap[0];
2271
+ while (i--) {
2272
+ tmp = tmp.lastChild;
2273
+ }
2274
+
2275
+ for (j=0, jj=tmp.childNodes.length; j<jj; ++j) nodes.push(tmp.childNodes[j]);
2276
+
2277
+ tmp = fragment.firstChild;
2278
+ tmp.textContent = "";
2279
+ }
2280
+
2281
+ // Remove wrapper from fragment
2282
+ fragment.textContent = "";
2283
+ fragment.innerHTML = ""; // Clear inner HTML
2284
+ return nodes;
2285
+ }
2286
+
2287
+ function jqLiteParseHTML(html, context) {
2288
+ context = context || document;
2289
+ var parsed;
2290
+
2291
+ if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
2292
+ return [context.createElement(parsed[1])];
2293
+ }
2294
+
2295
+ return jqLiteBuildFragment(html, context);
2296
+ }
2297
+
2229
2298
  /////////////////////////////////////////////
2230
2299
  function JQLite(element) {
2231
2300
  if (element instanceof JQLite) {
@@ -2242,14 +2311,9 @@ function JQLite(element) {
2242
2311
  }
2243
2312
 
2244
2313
  if (isString(element)) {
2245
- var div = document.createElement('div');
2246
- // Read about the NoScope elements here:
2247
- // http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
2248
- div.innerHTML = '<div>&#160;</div>' + element; // IE insanity to make NoScope elements work!
2249
- div.removeChild(div.firstChild); // remove the superfluous div
2250
- jqLiteAddNodes(this, div.childNodes);
2314
+ jqLiteAddNodes(this, jqLiteParseHTML(element));
2251
2315
  var fragment = jqLite(document.createDocumentFragment());
2252
- fragment.append(this); // detach the elements from the temporary DOM div.
2316
+ fragment.append(this);
2253
2317
  } else {
2254
2318
  jqLiteAddNodes(this, element);
2255
2319
  }
@@ -4575,7 +4639,8 @@ function $BrowserProvider(){
4575
4639
  * @name $cacheFactory
4576
4640
  *
4577
4641
  * @description
4578
- * Factory that constructs cache objects and gives access to them.
4642
+ * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
4643
+ * them.
4579
4644
  *
4580
4645
  * ```js
4581
4646
  *
@@ -4607,6 +4672,46 @@ function $BrowserProvider(){
4607
4672
  * - `{void}` `removeAll()` — Removes all cached values.
4608
4673
  * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
4609
4674
  *
4675
+ * @example
4676
+ <example module="cacheExampleApp">
4677
+ <file name="index.html">
4678
+ <div ng-controller="CacheController">
4679
+ <input ng-model="newCacheKey" placeholder="Key">
4680
+ <input ng-model="newCacheValue" placeholder="Value">
4681
+ <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
4682
+
4683
+ <p ng-if="keys.length">Cached Values</p>
4684
+ <div ng-repeat="key in keys">
4685
+ <span ng-bind="key"></span>
4686
+ <span>: </span>
4687
+ <b ng-bind="cache.get(key)"></b>
4688
+ </div>
4689
+
4690
+ <p>Cache Info</p>
4691
+ <div ng-repeat="(key, value) in cache.info()">
4692
+ <span ng-bind="key"></span>
4693
+ <span>: </span>
4694
+ <b ng-bind="value"></b>
4695
+ </div>
4696
+ </div>
4697
+ </file>
4698
+ <file name="script.js">
4699
+ angular.module('cacheExampleApp', []).
4700
+ controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
4701
+ $scope.keys = [];
4702
+ $scope.cache = $cacheFactory('cacheId');
4703
+ $scope.put = function(key, value) {
4704
+ $scope.cache.put(key, value);
4705
+ $scope.keys.push(key);
4706
+ };
4707
+ }]);
4708
+ </file>
4709
+ <file name="style.css">
4710
+ p {
4711
+ margin: 10px 0 3px;
4712
+ }
4713
+ </file>
4714
+ </example>
4610
4715
  */
4611
4716
  function $CacheFactoryProvider() {
4612
4717
 
@@ -4626,8 +4731,65 @@ function $CacheFactoryProvider() {
4626
4731
  freshEnd = null,
4627
4732
  staleEnd = null;
4628
4733
 
4734
+ /**
4735
+ * @ngdoc type
4736
+ * @name $cacheFactory.Cache
4737
+ *
4738
+ * @description
4739
+ * A cache object used to store and retrieve data, primarily used by
4740
+ * {@link $http $http} and the {@link ng.directive:script script} directive to cache
4741
+ * templates and other data.
4742
+ *
4743
+ * ```js
4744
+ * angular.module('superCache')
4745
+ * .factory('superCache', ['$cacheFactory', function($cacheFactory) {
4746
+ * return $cacheFactory('super-cache');
4747
+ * }]);
4748
+ * ```
4749
+ *
4750
+ * Example test:
4751
+ *
4752
+ * ```js
4753
+ * it('should behave like a cache', inject(function(superCache) {
4754
+ * superCache.put('key', 'value');
4755
+ * superCache.put('another key', 'another value');
4756
+ *
4757
+ * expect(superCache.info()).toEqual({
4758
+ * id: 'super-cache',
4759
+ * size: 2
4760
+ * });
4761
+ *
4762
+ * superCache.remove('another key');
4763
+ * expect(superCache.get('another key')).toBeUndefined();
4764
+ *
4765
+ * superCache.removeAll();
4766
+ * expect(superCache.info()).toEqual({
4767
+ * id: 'super-cache',
4768
+ * size: 0
4769
+ * });
4770
+ * }));
4771
+ * ```
4772
+ */
4629
4773
  return caches[cacheId] = {
4630
4774
 
4775
+ /**
4776
+ * @ngdoc method
4777
+ * @name $cacheFactory.Cache#put
4778
+ * @function
4779
+ *
4780
+ * @description
4781
+ * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
4782
+ * retrieved later, and incrementing the size of the cache if the key was not already
4783
+ * present in the cache. If behaving like an LRU cache, it will also remove stale
4784
+ * entries from the set.
4785
+ *
4786
+ * It will not insert undefined values into the cache.
4787
+ *
4788
+ * @param {string} key the key under which the cached data is stored.
4789
+ * @param {*} value the value to store alongside the key. If it is undefined, the key
4790
+ * will not be stored.
4791
+ * @returns {*} the value stored.
4792
+ */
4631
4793
  put: function(key, value) {
4632
4794
  if (capacity < Number.MAX_VALUE) {
4633
4795
  var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
@@ -4646,7 +4808,17 @@ function $CacheFactoryProvider() {
4646
4808
  return value;
4647
4809
  },
4648
4810
 
4649
-
4811
+ /**
4812
+ * @ngdoc method
4813
+ * @name $cacheFactory.Cache#get
4814
+ * @function
4815
+ *
4816
+ * @description
4817
+ * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
4818
+ *
4819
+ * @param {string} key the key of the data to be retrieved
4820
+ * @returns {*} the value stored.
4821
+ */
4650
4822
  get: function(key) {
4651
4823
  if (capacity < Number.MAX_VALUE) {
4652
4824
  var lruEntry = lruHash[key];
@@ -4660,6 +4832,16 @@ function $CacheFactoryProvider() {
4660
4832
  },
4661
4833
 
4662
4834
 
4835
+ /**
4836
+ * @ngdoc method
4837
+ * @name $cacheFactory.Cache#remove
4838
+ * @function
4839
+ *
4840
+ * @description
4841
+ * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
4842
+ *
4843
+ * @param {string} key the key of the entry to be removed
4844
+ */
4663
4845
  remove: function(key) {
4664
4846
  if (capacity < Number.MAX_VALUE) {
4665
4847
  var lruEntry = lruHash[key];
@@ -4678,6 +4860,14 @@ function $CacheFactoryProvider() {
4678
4860
  },
4679
4861
 
4680
4862
 
4863
+ /**
4864
+ * @ngdoc method
4865
+ * @name $cacheFactory.Cache#removeAll
4866
+ * @function
4867
+ *
4868
+ * @description
4869
+ * Clears the cache object of any entries.
4870
+ */
4681
4871
  removeAll: function() {
4682
4872
  data = {};
4683
4873
  size = 0;
@@ -4686,6 +4876,15 @@ function $CacheFactoryProvider() {
4686
4876
  },
4687
4877
 
4688
4878
 
4879
+ /**
4880
+ * @ngdoc method
4881
+ * @name $cacheFactory.Cache#destroy
4882
+ * @function
4883
+ *
4884
+ * @description
4885
+ * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
4886
+ * removing it from the {@link $cacheFactory $cacheFactory} set.
4887
+ */
4689
4888
  destroy: function() {
4690
4889
  data = null;
4691
4890
  stats = null;
@@ -4694,6 +4893,22 @@ function $CacheFactoryProvider() {
4694
4893
  },
4695
4894
 
4696
4895
 
4896
+ /**
4897
+ * @ngdoc method
4898
+ * @name $cacheFactory.Cache#info
4899
+ * @function
4900
+ *
4901
+ * @description
4902
+ * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
4903
+ *
4904
+ * @returns {object} an object with the following properties:
4905
+ * <ul>
4906
+ * <li>**id**: the id of the cache instance</li>
4907
+ * <li>**size**: the number of entries kept in the cache instance</li>
4908
+ * <li>**...**: any additional properties from the options object when creating the
4909
+ * cache.</li>
4910
+ * </ul>
4911
+ */
4697
4912
  info: function() {
4698
4913
  return extend({}, stats, {size: size});
4699
4914
  }
@@ -4880,6 +5095,7 @@ function $TemplateCacheProvider() {
4880
5095
  * restrict: 'A',
4881
5096
  * scope: false,
4882
5097
  * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
5098
+ * controllerAs: 'stringAlias',
4883
5099
  * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
4884
5100
  * compile: function compile(tElement, tAttrs, transclude) {
4885
5101
  * return {
@@ -5097,6 +5313,16 @@ function $TemplateCacheProvider() {
5097
5313
  * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
5098
5314
  * should be done in a linking function rather than in a compile function.
5099
5315
  * </div>
5316
+
5317
+ * <div class="alert alert-warning">
5318
+ * **Note:** The compile function cannot handle directives that recursively use themselves in their
5319
+ * own templates or compile functions. Compiling these directives results in an infinite loop and a
5320
+ * stack overflow errors.
5321
+ *
5322
+ * This can be avoided by manually using $compile in the postLink function to imperatively compile
5323
+ * a directive's template instead of relying on automatic template compilation via `template` or
5324
+ * `templateUrl` declaration or manual compilation inside the compile function.
5325
+ * </div>
5100
5326
  *
5101
5327
  * <div class="alert alert-error">
5102
5328
  * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
@@ -5318,8 +5544,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
5318
5544
  var hasDirectives = {},
5319
5545
  Suffix = 'Directive',
5320
5546
  COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
5321
- CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
5322
- TABLE_CONTENT_REGEXP = /^<\s*(tr|th|td|thead|tbody|tfoot)(\s+[^>]*)?>/i;
5547
+ CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/;
5323
5548
 
5324
5549
  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
5325
5550
  // The assumption is that future DOM event attribute names will begin with
@@ -6061,7 +6286,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6061
6286
 
6062
6287
  if (directive.replace) {
6063
6288
  replaceDirective = directive;
6064
- $template = directiveTemplateContents(directiveValue);
6289
+ if (jqLiteIsTextNode(directiveValue)) {
6290
+ $template = [];
6291
+ } else {
6292
+ $template = jqLite(directiveValue);
6293
+ }
6065
6294
  compileNode = $template[0];
6066
6295
 
6067
6296
  if ($template.length != 1 || compileNode.nodeType !== 1) {
@@ -6460,27 +6689,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6460
6689
  }
6461
6690
 
6462
6691
 
6463
- function directiveTemplateContents(template) {
6464
- var type;
6465
- template = trim(template);
6466
- if ((type = TABLE_CONTENT_REGEXP.exec(template))) {
6467
- type = type[1].toLowerCase();
6468
- var table = jqLite('<table>' + template + '</table>');
6469
- if (/(thead|tbody|tfoot)/.test(type)) {
6470
- return table.children(type);
6471
- }
6472
- table = table.children('tbody');
6473
- if (type === 'tr') {
6474
- return table.children('tr');
6475
- }
6476
- return table.children('tr').contents();
6477
- }
6478
- return jqLite('<div>' +
6479
- template +
6480
- '</div>').contents();
6481
- }
6482
-
6483
-
6484
6692
  function compileTemplateUrl(directives, $compileNode, tAttrs,
6485
6693
  $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
6486
6694
  var linkQueue = [],
@@ -6505,7 +6713,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6505
6713
  content = denormalizeTemplate(content);
6506
6714
 
6507
6715
  if (origAsyncDirective.replace) {
6508
- $template = directiveTemplateContents(content);
6716
+ if (jqLiteIsTextNode(content)) {
6717
+ $template = [];
6718
+ } else {
6719
+ $template = jqLite(content);
6720
+ }
6509
6721
  compileNode = $template[0];
6510
6722
 
6511
6723
  if ($template.length != 1 || compileNode.nodeType !== 1) {
@@ -7283,7 +7495,7 @@ function $HttpProvider() {
7283
7495
  *
7284
7496
  * ```
7285
7497
  * module.run(function($http) {
7286
- * $http.defaults.headers.common.Authentication = 'Basic YmVlcDpib29w'
7498
+ * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'
7287
7499
  * });
7288
7500
  * ```
7289
7501
  *
@@ -7577,6 +7789,7 @@ function $HttpProvider() {
7577
7789
  * - **status** – `{number}` – HTTP status code of the response.
7578
7790
  * - **headers** – `{function([headerName])}` – Header getter function.
7579
7791
  * - **config** – `{Object}` – The configuration object that was used to generate the request.
7792
+ * - **statusText** – `{string}` – HTTP status text of the response.
7580
7793
  *
7581
7794
  * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
7582
7795
  * requests. This is primarily meant to be used for debugging purposes.
@@ -7951,9 +8164,9 @@ function $HttpProvider() {
7951
8164
  } else {
7952
8165
  // serving from cache
7953
8166
  if (isArray(cachedResp)) {
7954
- resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2]));
8167
+ resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2]), cachedResp[3]);
7955
8168
  } else {
7956
- resolvePromise(cachedResp, 200, {});
8169
+ resolvePromise(cachedResp, 200, {}, 'OK');
7957
8170
  }
7958
8171
  }
7959
8172
  } else {
@@ -7977,17 +8190,17 @@ function $HttpProvider() {
7977
8190
  * - resolves the raw $http promise
7978
8191
  * - calls $apply
7979
8192
  */
7980
- function done(status, response, headersString) {
8193
+ function done(status, response, headersString, statusText) {
7981
8194
  if (cache) {
7982
8195
  if (isSuccess(status)) {
7983
- cache.put(url, [status, response, parseHeaders(headersString)]);
8196
+ cache.put(url, [status, response, parseHeaders(headersString), statusText]);
7984
8197
  } else {
7985
8198
  // remove promise from the cache
7986
8199
  cache.remove(url);
7987
8200
  }
7988
8201
  }
7989
8202
 
7990
- resolvePromise(response, status, headersString);
8203
+ resolvePromise(response, status, headersString, statusText);
7991
8204
  if (!$rootScope.$$phase) $rootScope.$apply();
7992
8205
  }
7993
8206
 
@@ -7995,7 +8208,7 @@ function $HttpProvider() {
7995
8208
  /**
7996
8209
  * Resolves the raw $http promise.
7997
8210
  */
7998
- function resolvePromise(response, status, headers) {
8211
+ function resolvePromise(response, status, headers, statusText) {
7999
8212
  // normalize internal statuses to 0
8000
8213
  status = Math.max(status, 0);
8001
8214
 
@@ -8003,7 +8216,8 @@ function $HttpProvider() {
8003
8216
  data: response,
8004
8217
  status: status,
8005
8218
  headers: headersGetter(headers),
8006
- config: config
8219
+ config: config,
8220
+ statusText : statusText
8007
8221
  });
8008
8222
  }
8009
8223
 
@@ -8137,7 +8351,8 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
8137
8351
  completeRequest(callback,
8138
8352
  status || xhr.status,
8139
8353
  response,
8140
- responseHeaders);
8354
+ responseHeaders,
8355
+ xhr.statusText || '');
8141
8356
  }
8142
8357
  };
8143
8358
 
@@ -8178,7 +8393,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
8178
8393
  xhr && xhr.abort();
8179
8394
  }
8180
8395
 
8181
- function completeRequest(callback, status, response, headersString) {
8396
+ function completeRequest(callback, status, response, headersString, statusText) {
8182
8397
  // cancel timeout and subsequent timeout promise resolution
8183
8398
  timeoutId && $browserDefer.cancel(timeoutId);
8184
8399
  jsonpDone = xhr = null;
@@ -8191,9 +8406,10 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
8191
8406
  }
8192
8407
 
8193
8408
  // normalize IE bug (http://bugs.jquery.com/ticket/1450)
8194
- status = status == 1223 ? 204 : status;
8409
+ status = status === 1223 ? 204 : status;
8410
+ statusText = statusText || '';
8195
8411
 
8196
- callback(status, response, headersString);
8412
+ callback(status, response, headersString, statusText);
8197
8413
  $browser.$$completeOutstandingRequest(noop);
8198
8414
  }
8199
8415
  };
@@ -9229,8 +9445,7 @@ function locationGetterSetter(property, preprocess) {
9229
9445
  * - Clicks on a link.
9230
9446
  * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
9231
9447
  *
9232
- * For more information see {@link guide/dev_guide.services.$location Developer Guide: Angular
9233
- * Services: Using $location}
9448
+ * For more information see {@link guide/$location Developer Guide: Using $location}
9234
9449
  */
9235
9450
 
9236
9451
  /**
@@ -9966,7 +10181,11 @@ var Parser = function (lexer, $filter, options) {
9966
10181
  this.options = options;
9967
10182
  };
9968
10183
 
9969
- Parser.ZERO = function () { return 0; };
10184
+ Parser.ZERO = extend(function () {
10185
+ return 0;
10186
+ }, {
10187
+ constant: true
10188
+ });
9970
10189
 
9971
10190
  Parser.prototype = {
9972
10191
  constructor: Parser,
@@ -11711,7 +11930,8 @@ function $RootScopeProvider(){
11711
11930
  * - `function(newValue, oldValue, scope)`: called with current and previous values as
11712
11931
  * parameters.
11713
11932
  *
11714
- * @param {boolean=} objectEquality Compare object for equality rather than for reference.
11933
+ * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of
11934
+ * comparing for reference equality.
11715
11935
  * @returns {function()} Returns a deregistration function for this listener.
11716
11936
  */
11717
11937
  $watch: function(watchExp, listener, objectEquality) {
@@ -12132,15 +12352,32 @@ function $RootScopeProvider(){
12132
12352
 
12133
12353
  forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));
12134
12354
 
12355
+ // sever all the references to parent scopes (after this cleanup, the current scope should
12356
+ // not be retained by any of our references and should be eligible for garbage collection)
12135
12357
  if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
12136
12358
  if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
12137
12359
  if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
12138
12360
  if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
12139
12361
 
12140
- // This is bogus code that works around Chrome's GC leak
12141
- // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
12362
+
12363
+ // All of the code below is bogus code that works around V8's memory leak via optimized code
12364
+ // and inline caches.
12365
+ //
12366
+ // see:
12367
+ // - https://code.google.com/p/v8/issues/detail?id=2073#c26
12368
+ // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
12369
+ // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
12370
+
12142
12371
  this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
12143
- this.$$childTail = null;
12372
+ this.$$childTail = this.$root = null;
12373
+
12374
+ // don't reset these to null in case some async task tries to register a listener/watch/task
12375
+ this.$$listeners = {};
12376
+ this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = [];
12377
+
12378
+ // prevent NPEs since these methods have references to properties we nulled out
12379
+ this.$destroy = this.$digest = this.$apply = noop;
12380
+ this.$on = this.$watch = function() { return noop; };
12144
12381
  },
12145
12382
 
12146
12383
  /**
@@ -13109,7 +13346,7 @@ function $SceDelegateProvider() {
13109
13346
  * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. |
13110
13347
  * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
13111
13348
  * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
13112
- * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contens are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
13349
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
13113
13350
  * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
13114
13351
  *
13115
13352
  * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
@@ -14927,7 +15164,7 @@ function limitToFilter(){
14927
15164
  * - `Array`: An array of function or string predicates. The first predicate in the array
14928
15165
  * is used for sorting, but when two items are equivalent, the next predicate is used.
14929
15166
  *
14930
- * @param {boolean=} reverse Reverse the order the array.
15167
+ * @param {boolean=} reverse Reverse the order of the array.
14931
15168
  * @returns {Array} Sorted copy of the source array.
14932
15169
  *
14933
15170
  * @example
@@ -15692,6 +15929,10 @@ function FormController(element, attrs, $scope, $animate) {
15692
15929
  * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
15693
15930
  * sub-group of controls needs to be determined.
15694
15931
  *
15932
+ * Note: the purpose of `ngForm` is to group controls,
15933
+ * but not to be a replacement for the `<form>` tag with all of its capabilities
15934
+ * (e.g. posting to the server, ...).
15935
+ *
15695
15936
  * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
15696
15937
  * related scope, under this name.
15697
15938
  *
@@ -16348,7 +16589,6 @@ function addNativeHtml5Validators(ctrl, validatorName, element) {
16348
16589
  return value;
16349
16590
  };
16350
16591
  ctrl.$parsers.push(validator);
16351
- ctrl.$formatters.push(validator);
16352
16592
  }
16353
16593
  }
16354
16594
 
@@ -17675,7 +17915,7 @@ var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
17675
17915
 
17676
17916
  function classDirective(name, selector) {
17677
17917
  name = 'ngClass' + name;
17678
- return function() {
17918
+ return ['$animate', function($animate) {
17679
17919
  return {
17680
17920
  restrict: 'AC',
17681
17921
  link: function(scope, element, attr) {
@@ -17693,46 +17933,100 @@ function classDirective(name, selector) {
17693
17933
  // jshint bitwise: false
17694
17934
  var mod = $index & 1;
17695
17935
  if (mod !== old$index & 1) {
17696
- var classes = flattenClasses(scope.$eval(attr[name]));
17936
+ var classes = arrayClasses(scope.$eval(attr[name]));
17697
17937
  mod === selector ?
17698
- attr.$addClass(classes) :
17699
- attr.$removeClass(classes);
17938
+ addClasses(classes) :
17939
+ removeClasses(classes);
17940
+ }
17941
+ });
17942
+ }
17943
+
17944
+ function addClasses(classes) {
17945
+ var newClasses = digestClassCounts(classes, 1);
17946
+ attr.$addClass(newClasses);
17947
+ }
17948
+
17949
+ function removeClasses(classes) {
17950
+ var newClasses = digestClassCounts(classes, -1);
17951
+ attr.$removeClass(newClasses);
17952
+ }
17953
+
17954
+ function digestClassCounts (classes, count) {
17955
+ var classCounts = element.data('$classCounts') || {};
17956
+ var classesToUpdate = [];
17957
+ forEach(classes, function (className) {
17958
+ if (count > 0 || classCounts[className]) {
17959
+ classCounts[className] = (classCounts[className] || 0) + count;
17960
+ if (classCounts[className] === +(count > 0)) {
17961
+ classesToUpdate.push(className);
17962
+ }
17700
17963
  }
17701
17964
  });
17965
+ element.data('$classCounts', classCounts);
17966
+ return classesToUpdate.join(' ');
17702
17967
  }
17703
17968
 
17969
+ function updateClasses (oldClasses, newClasses) {
17970
+ var toAdd = arrayDifference(newClasses, oldClasses);
17971
+ var toRemove = arrayDifference(oldClasses, newClasses);
17972
+ toRemove = digestClassCounts(toRemove, -1);
17973
+ toAdd = digestClassCounts(toAdd, 1);
17974
+
17975
+ if (toAdd.length === 0) {
17976
+ $animate.removeClass(element, toRemove);
17977
+ } else if (toRemove.length === 0) {
17978
+ $animate.addClass(element, toAdd);
17979
+ } else {
17980
+ $animate.setClass(element, toAdd, toRemove);
17981
+ }
17982
+ }
17704
17983
 
17705
17984
  function ngClassWatchAction(newVal) {
17706
17985
  if (selector === true || scope.$index % 2 === selector) {
17707
- var newClasses = flattenClasses(newVal || '');
17708
- if(!oldVal) {
17709
- attr.$addClass(newClasses);
17710
- } else if(!equals(newVal,oldVal)) {
17711
- attr.$updateClass(newClasses, flattenClasses(oldVal));
17986
+ var newClasses = arrayClasses(newVal || []);
17987
+ if (!oldVal) {
17988
+ addClasses(newClasses);
17989
+ } else if (!equals(newVal,oldVal)) {
17990
+ var oldClasses = arrayClasses(oldVal);
17991
+ updateClasses(oldClasses, newClasses);
17712
17992
  }
17713
17993
  }
17714
17994
  oldVal = copy(newVal);
17715
17995
  }
17996
+ }
17997
+ };
17716
17998
 
17999
+ function arrayDifference(tokens1, tokens2) {
18000
+ var values = [];
17717
18001
 
17718
- function flattenClasses(classVal) {
17719
- if(isArray(classVal)) {
17720
- return classVal.join(' ');
17721
- } else if (isObject(classVal)) {
17722
- var classes = [], i = 0;
17723
- forEach(classVal, function(v, k) {
17724
- if (v) {
17725
- classes.push(k);
17726
- }
17727
- });
17728
- return classes.join(' ');
17729
- }
17730
-
17731
- return classVal;
18002
+ outer:
18003
+ for(var i = 0; i < tokens1.length; i++) {
18004
+ var token = tokens1[i];
18005
+ for(var j = 0; j < tokens2.length; j++) {
18006
+ if(token == tokens2[j]) continue outer;
17732
18007
  }
18008
+ values.push(token);
17733
18009
  }
17734
- };
17735
- };
18010
+ return values;
18011
+ }
18012
+
18013
+ function arrayClasses (classVal) {
18014
+ if (isArray(classVal)) {
18015
+ return classVal;
18016
+ } else if (isString(classVal)) {
18017
+ return classVal.split(' ');
18018
+ } else if (isObject(classVal)) {
18019
+ var classes = [], i = 0;
18020
+ forEach(classVal, function(v, k) {
18021
+ if (v) {
18022
+ classes.push(k);
18023
+ }
18024
+ });
18025
+ return classes;
18026
+ }
18027
+ return classVal;
18028
+ }
18029
+ }];
17736
18030
  }
17737
18031
 
17738
18032
  /**
@@ -18293,7 +18587,7 @@ var ngControllerDirective = [function() {
18293
18587
  * @element ANY
18294
18588
  * @priority 0
18295
18589
  * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
18296
- * click. (Event object is available as `$event`)
18590
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
18297
18591
  *
18298
18592
  * @example
18299
18593
  <example>
@@ -18374,7 +18668,7 @@ forEach(
18374
18668
  * @element ANY
18375
18669
  * @priority 0
18376
18670
  * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
18377
- * mousedown. (Event object is available as `$event`)
18671
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
18378
18672
  *
18379
18673
  * @example
18380
18674
  <example>
@@ -18398,7 +18692,7 @@ forEach(
18398
18692
  * @element ANY
18399
18693
  * @priority 0
18400
18694
  * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
18401
- * mouseup. (Event object is available as `$event`)
18695
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
18402
18696
  *
18403
18697
  * @example
18404
18698
  <example>
@@ -18421,7 +18715,7 @@ forEach(
18421
18715
  * @element ANY
18422
18716
  * @priority 0
18423
18717
  * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
18424
- * mouseover. (Event object is available as `$event`)
18718
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
18425
18719
  *
18426
18720
  * @example
18427
18721
  <example>
@@ -18445,7 +18739,7 @@ forEach(
18445
18739
  * @element ANY
18446
18740
  * @priority 0
18447
18741
  * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
18448
- * mouseenter. (Event object is available as `$event`)
18742
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
18449
18743
  *
18450
18744
  * @example
18451
18745
  <example>
@@ -18469,7 +18763,7 @@ forEach(
18469
18763
  * @element ANY
18470
18764
  * @priority 0
18471
18765
  * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
18472
- * mouseleave. (Event object is available as `$event`)
18766
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
18473
18767
  *
18474
18768
  * @example
18475
18769
  <example>
@@ -18493,7 +18787,7 @@ forEach(
18493
18787
  * @element ANY
18494
18788
  * @priority 0
18495
18789
  * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
18496
- * mousemove. (Event object is available as `$event`)
18790
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
18497
18791
  *
18498
18792
  * @example
18499
18793
  <example>
@@ -18560,7 +18854,8 @@ forEach(
18560
18854
  *
18561
18855
  * @element ANY
18562
18856
  * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
18563
- * keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
18857
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
18858
+ * and can be interrogated for keyCode, altKey, etc.)
18564
18859
  *
18565
18860
  * @example
18566
18861
  <example>
@@ -18585,7 +18880,8 @@ forEach(
18585
18880
  *
18586
18881
  * @element form
18587
18882
  * @priority 0
18588
- * @param {expression} ngSubmit {@link guide/expression Expression} to eval. (Event object is available as `$event`)
18883
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
18884
+ * ({@link guide/expression#-event- Event object is available as `$event`})
18589
18885
  *
18590
18886
  * @example
18591
18887
  <example>
@@ -18636,7 +18932,7 @@ forEach(
18636
18932
  * @element window, input, select, textarea, a
18637
18933
  * @priority 0
18638
18934
  * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
18639
- * focus. (Event object is available as `$event`)
18935
+ * focus. ({@link guide/expression#-event- Event object is available as `$event`})
18640
18936
  *
18641
18937
  * @example
18642
18938
  * See {@link ng.directive:ngClick ngClick}
@@ -18652,7 +18948,7 @@ forEach(
18652
18948
  * @element window, input, select, textarea, a
18653
18949
  * @priority 0
18654
18950
  * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
18655
- * blur. (Event object is available as `$event`)
18951
+ * blur. ({@link guide/expression#-event- Event object is available as `$event`})
18656
18952
  *
18657
18953
  * @example
18658
18954
  * See {@link ng.directive:ngClick ngClick}
@@ -18668,7 +18964,7 @@ forEach(
18668
18964
  * @element window, input, select, textarea, a
18669
18965
  * @priority 0
18670
18966
  * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
18671
- * copy. (Event object is available as `$event`)
18967
+ * copy. ({@link guide/expression#-event- Event object is available as `$event`})
18672
18968
  *
18673
18969
  * @example
18674
18970
  <example>
@@ -18689,7 +18985,7 @@ forEach(
18689
18985
  * @element window, input, select, textarea, a
18690
18986
  * @priority 0
18691
18987
  * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
18692
- * cut. (Event object is available as `$event`)
18988
+ * cut. ({@link guide/expression#-event- Event object is available as `$event`})
18693
18989
  *
18694
18990
  * @example
18695
18991
  <example>
@@ -18710,7 +19006,7 @@ forEach(
18710
19006
  * @element window, input, select, textarea, a
18711
19007
  * @priority 0
18712
19008
  * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
18713
- * paste. (Event object is available as `$event`)
19009
+ * paste. ({@link guide/expression#-event- Event object is available as `$event`})
18714
19010
  *
18715
19011
  * @example
18716
19012
  <example>
@@ -19983,7 +20279,7 @@ var ngShowDirective = ['$animate', function($animate) {
19983
20279
  * in AngularJS and sets the display style to none (using an !important flag).
19984
20280
  * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
19985
20281
  *
19986
- * ```hrml
20282
+ * ```html
19987
20283
  * <!-- when $scope.myValue is truthy (element is hidden) -->
19988
20284
  * <div ng-hide="myValue"></div>
19989
20285
  *