angularjs-rails 1.2.20 → 1.2.21

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.20
2
+ * @license AngularJS v1.2.21
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.20
2
+ * @license AngularJS v1.2.21
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.20/' +
71
+ message = message + '\nhttp://errors.angularjs.org/1.2.21/' +
72
72
  (module ? module + '/' : '') + code;
73
73
  for (i = 2; i < arguments.length; i++) {
74
74
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
@@ -80,89 +80,88 @@ function minErr(module) {
80
80
  }
81
81
 
82
82
  /* We need to tell jshint what variables are being exported */
83
- /* global
84
- -angular,
85
- -msie,
86
- -jqLite,
87
- -jQuery,
88
- -slice,
89
- -push,
90
- -toString,
91
- -ngMinErr,
92
- -angularModule,
93
- -nodeName_,
94
- -uid,
95
- -VALIDITY_STATE_PROPERTY,
96
-
97
- -lowercase,
98
- -uppercase,
99
- -manualLowercase,
100
- -manualUppercase,
101
- -nodeName_,
102
- -isArrayLike,
103
- -forEach,
104
- -sortedKeys,
105
- -forEachSorted,
106
- -reverseParams,
107
- -nextUid,
108
- -setHashKey,
109
- -extend,
110
- -int,
111
- -inherit,
112
- -noop,
113
- -identity,
114
- -valueFn,
115
- -isUndefined,
116
- -isDefined,
117
- -isObject,
118
- -isString,
119
- -isNumber,
120
- -isDate,
121
- -isArray,
122
- -isFunction,
123
- -isRegExp,
124
- -isWindow,
125
- -isScope,
126
- -isFile,
127
- -isBlob,
128
- -isBoolean,
129
- -trim,
130
- -isElement,
131
- -makeMap,
132
- -map,
133
- -size,
134
- -includes,
135
- -indexOf,
136
- -arrayRemove,
137
- -isLeafNode,
138
- -copy,
139
- -shallowCopy,
140
- -equals,
141
- -csp,
142
- -concat,
143
- -sliceArgs,
144
- -bind,
145
- -toJsonReplacer,
146
- -toJson,
147
- -fromJson,
148
- -toBoolean,
149
- -startingTag,
150
- -tryDecodeURIComponent,
151
- -parseKeyValue,
152
- -toKeyValue,
153
- -encodeUriSegment,
154
- -encodeUriQuery,
155
- -angularInit,
156
- -bootstrap,
157
- -snake_case,
158
- -bindJQuery,
159
- -assertArg,
160
- -assertArgFn,
161
- -assertNotHasOwnProperty,
162
- -getter,
163
- -getBlockElements,
164
- -hasOwnProperty,
165
-
83
+ /* global angular: true,
84
+ msie: true,
85
+ jqLite: true,
86
+ jQuery: true,
87
+ slice: true,
88
+ push: true,
89
+ toString: true,
90
+ ngMinErr: true,
91
+ angularModule: true,
92
+ nodeName_: true,
93
+ uid: true,
94
+ VALIDITY_STATE_PROPERTY: true,
95
+
96
+ lowercase: true,
97
+ uppercase: true,
98
+ manualLowercase: true,
99
+ manualUppercase: true,
100
+ nodeName_: true,
101
+ isArrayLike: true,
102
+ forEach: true,
103
+ sortedKeys: true,
104
+ forEachSorted: true,
105
+ reverseParams: true,
106
+ nextUid: true,
107
+ setHashKey: true,
108
+ extend: true,
109
+ int: true,
110
+ inherit: true,
111
+ noop: true,
112
+ identity: true,
113
+ valueFn: true,
114
+ isUndefined: true,
115
+ isDefined: true,
116
+ isObject: true,
117
+ isString: true,
118
+ isNumber: true,
119
+ isDate: true,
120
+ isArray: true,
121
+ isFunction: true,
122
+ isRegExp: true,
123
+ isWindow: true,
124
+ isScope: true,
125
+ isFile: true,
126
+ isBlob: true,
127
+ isBoolean: true,
128
+ isPromiseLike: true,
129
+ trim: true,
130
+ isElement: true,
131
+ makeMap: true,
132
+ map: true,
133
+ size: true,
134
+ includes: true,
135
+ indexOf: true,
136
+ arrayRemove: true,
137
+ isLeafNode: true,
138
+ copy: true,
139
+ shallowCopy: true,
140
+ equals: true,
141
+ csp: true,
142
+ concat: true,
143
+ sliceArgs: true,
144
+ bind: true,
145
+ toJsonReplacer: true,
146
+ toJson: true,
147
+ fromJson: true,
148
+ toBoolean: true,
149
+ startingTag: true,
150
+ tryDecodeURIComponent: true,
151
+ parseKeyValue: true,
152
+ toKeyValue: true,
153
+ encodeUriSegment: true,
154
+ encodeUriQuery: true,
155
+ angularInit: true,
156
+ bootstrap: true,
157
+ snake_case: true,
158
+ bindJQuery: true,
159
+ assertArg: true,
160
+ assertArgFn: true,
161
+ assertNotHasOwnProperty: true,
162
+ getter: true,
163
+ getBlockElements: true,
164
+ hasOwnProperty: true,
166
165
  */
167
166
 
168
167
  ////////////////////////////////////
@@ -321,11 +320,12 @@ function forEach(obj, iterator, context) {
321
320
  iterator.call(context, obj[key], key);
322
321
  }
323
322
  }
324
- } else if (obj.forEach && obj.forEach !== forEach) {
325
- obj.forEach(iterator, context);
326
- } else if (isArrayLike(obj)) {
327
- for (key = 0; key < obj.length; key++)
323
+ } else if (isArray(obj) || isArrayLike(obj)) {
324
+ for (key = 0; key < obj.length; key++) {
328
325
  iterator.call(context, obj[key], key);
326
+ }
327
+ } else if (obj.forEach && obj.forEach !== forEach) {
328
+ obj.forEach(iterator, context);
329
329
  } else {
330
330
  for (key in obj) {
331
331
  if (obj.hasOwnProperty(key)) {
@@ -662,6 +662,11 @@ function isBoolean(value) {
662
662
  }
663
663
 
664
664
 
665
+ function isPromiseLike(obj) {
666
+ return obj && isFunction(obj.then);
667
+ }
668
+
669
+
665
670
  var trim = (function() {
666
671
  // native trim is way faster: http://jsperf.com/angular-trim-test
667
672
  // but IE doesn't have it... :-(
@@ -826,7 +831,7 @@ function isLeafNode (node) {
826
831
  </div>
827
832
 
828
833
  <script>
829
- angular.module('copyExample')
834
+ angular.module('copyExample', [])
830
835
  .controller('ExampleController', ['$scope', function($scope) {
831
836
  $scope.master= {};
832
837
 
@@ -860,7 +865,8 @@ function copy(source, destination, stackSource, stackDest) {
860
865
  } else if (isDate(source)) {
861
866
  destination = new Date(source.getTime());
862
867
  } else if (isRegExp(source)) {
863
- destination = new RegExp(source.source);
868
+ destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
869
+ destination.lastIndex = source.lastIndex;
864
870
  } else if (isObject(source)) {
865
871
  destination = copy(source, {}, stackSource, stackDest);
866
872
  }
@@ -1004,12 +1010,25 @@ function equals(o1, o2) {
1004
1010
  return false;
1005
1011
  }
1006
1012
 
1013
+ var csp = function() {
1014
+ if (isDefined(csp.isActive_)) return csp.isActive_;
1015
+
1016
+ var active = !!(document.querySelector('[ng-csp]') ||
1017
+ document.querySelector('[data-ng-csp]'));
1018
+
1019
+ if (!active) {
1020
+ try {
1021
+ /* jshint -W031, -W054 */
1022
+ new Function('');
1023
+ /* jshint +W031, +W054 */
1024
+ } catch (e) {
1025
+ active = true;
1026
+ }
1027
+ }
1028
+
1029
+ return (csp.isActive_ = active);
1030
+ };
1007
1031
 
1008
- function csp() {
1009
- return (document.securityPolicy && document.securityPolicy.isActive) ||
1010
- (document.querySelector &&
1011
- !!(document.querySelector('[ng-csp]') || document.querySelector('[data-ng-csp]')));
1012
- }
1013
1032
 
1014
1033
 
1015
1034
  function concat(array1, array2, index) {
@@ -1181,7 +1200,7 @@ function parseKeyValue(/**string*/keyValue) {
1181
1200
  var obj = {}, key_value, key;
1182
1201
  forEach((keyValue || "").split('&'), function(keyValue) {
1183
1202
  if ( keyValue ) {
1184
- key_value = keyValue.split('=');
1203
+ key_value = keyValue.replace(/\+/g,'%20').split('=');
1185
1204
  key = tryDecodeURIComponent(key_value[0]);
1186
1205
  if ( isDefined(key) ) {
1187
1206
  var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
@@ -1866,12 +1885,11 @@ function setupModuleLoader(window) {
1866
1885
 
1867
1886
  }
1868
1887
 
1869
- /* global
1870
- angularModule: true,
1871
- version: true,
1888
+ /* global angularModule: true,
1889
+ version: true,
1872
1890
 
1873
- $LocaleProvider,
1874
- $CompileProvider,
1891
+ $LocaleProvider,
1892
+ $CompileProvider,
1875
1893
 
1876
1894
  htmlAnchorDirective,
1877
1895
  inputDirective,
@@ -1959,11 +1977,11 @@ function setupModuleLoader(window) {
1959
1977
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1960
1978
  */
1961
1979
  var version = {
1962
- full: '1.2.20', // all of these placeholder strings will be replaced by grunt's
1980
+ full: '1.2.21', // all of these placeholder strings will be replaced by grunt's
1963
1981
  major: 1, // package task
1964
1982
  minor: 2,
1965
- dot: 20,
1966
- codeName: 'accidental-beautification'
1983
+ dot: 21,
1984
+ codeName: 'wizard-props'
1967
1985
  };
1968
1986
 
1969
1987
 
@@ -2087,12 +2105,10 @@ function publishExternalAPI(angular){
2087
2105
  ]);
2088
2106
  }
2089
2107
 
2090
- /* global
2091
-
2092
- -JQLitePrototype,
2093
- -addEventListenerFn,
2094
- -removeEventListenerFn,
2095
- -BOOLEAN_ATTR
2108
+ /* global JQLitePrototype: true,
2109
+ addEventListenerFn: true,
2110
+ removeEventListenerFn: true,
2111
+ BOOLEAN_ATTR: true
2096
2112
  */
2097
2113
 
2098
2114
  //////////////////////////////////
@@ -2506,25 +2522,22 @@ function jqLiteController(element, name) {
2506
2522
  }
2507
2523
 
2508
2524
  function jqLiteInheritedData(element, name, value) {
2509
- element = jqLite(element);
2510
-
2511
2525
  // if element is the document object work with the html element instead
2512
2526
  // this makes $(document).scope() possible
2513
- if(element[0].nodeType == 9) {
2514
- element = element.find('html');
2527
+ if(element.nodeType == 9) {
2528
+ element = element.documentElement;
2515
2529
  }
2516
2530
  var names = isArray(name) ? name : [name];
2517
2531
 
2518
- while (element.length) {
2519
- var node = element[0];
2532
+ while (element) {
2520
2533
  for (var i = 0, ii = names.length; i < ii; i++) {
2521
- if ((value = element.data(names[i])) !== undefined) return value;
2534
+ if ((value = jqLite.data(element, names[i])) !== undefined) return value;
2522
2535
  }
2523
2536
 
2524
2537
  // If dealing with a document fragment node with a host element, and no parent, use the host
2525
2538
  // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
2526
2539
  // to lookup parent controllers.
2527
- element = jqLite(node.parentNode || (node.nodeType === 11 && node.host));
2540
+ element = element.parentNode || (element.nodeType === 11 && element.host);
2528
2541
  }
2529
2542
  }
2530
2543
 
@@ -2599,18 +2612,25 @@ function getBooleanAttrName(element, name) {
2599
2612
  return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr;
2600
2613
  }
2601
2614
 
2615
+ forEach({
2616
+ data: jqLiteData,
2617
+ removeData: jqLiteRemoveData
2618
+ }, function(fn, name) {
2619
+ JQLite[name] = fn;
2620
+ });
2621
+
2602
2622
  forEach({
2603
2623
  data: jqLiteData,
2604
2624
  inheritedData: jqLiteInheritedData,
2605
2625
 
2606
2626
  scope: function(element) {
2607
2627
  // Can't use jqLiteData here directly so we stay compatible with jQuery!
2608
- return jqLite(element).data('$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
2628
+ return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
2609
2629
  },
2610
2630
 
2611
2631
  isolateScope: function(element) {
2612
2632
  // Can't use jqLiteData here directly so we stay compatible with jQuery!
2613
- return jqLite(element).data('$isolateScope') || jqLite(element).data('$isolateScopeNoTemplate');
2633
+ return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
2614
2634
  },
2615
2635
 
2616
2636
  controller: jqLiteController,
@@ -3038,7 +3058,9 @@ forEach({
3038
3058
  clone: jqLiteClone,
3039
3059
 
3040
3060
  triggerHandler: function(element, eventName, eventData) {
3041
- var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName];
3061
+ // Copy event handlers in case event handlers array is modified during execution.
3062
+ var eventFns = (jqLiteExpandoStore(element, 'events') || {})[eventName],
3063
+ eventFnsCopy = shallowCopy(eventFns || []);
3042
3064
 
3043
3065
  eventData = eventData || [];
3044
3066
 
@@ -3047,7 +3069,7 @@ forEach({
3047
3069
  stopPropagation: noop
3048
3070
  }];
3049
3071
 
3050
- forEach(eventFns, function(fn) {
3072
+ forEach(eventFnsCopy, function(fn) {
3051
3073
  fn.apply(element, event.concat(eventData));
3052
3074
  });
3053
3075
  }
@@ -5293,14 +5315,16 @@ function $TemplateCacheProvider() {
5293
5315
  *
5294
5316
  *
5295
5317
  * #### `template`
5296
- * replace the current element with the contents of the HTML. The replacement process
5297
- * migrates all of the attributes / classes from the old element to the new one. See the
5298
- * {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive
5299
- * Directives Guide} for an example.
5318
+ * HTML markup that may:
5319
+ * * Replace the contents of the directive's element (defualt).
5320
+ * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
5321
+ * * Wrap the contents of the directive's element (if `transclude` is true).
5300
5322
  *
5301
- * You can specify `template` as a string representing the template or as a function which takes
5302
- * two arguments `tElement` and `tAttrs` (described in the `compile` function api below) and
5303
- * returns a string value representing the template.
5323
+ * Value may be:
5324
+ *
5325
+ * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
5326
+ * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
5327
+ * function api below) and returns a string value.
5304
5328
  *
5305
5329
  *
5306
5330
  * #### `templateUrl`
@@ -5315,11 +5339,14 @@ function $TemplateCacheProvider() {
5315
5339
  *
5316
5340
  *
5317
5341
  * #### `replace` ([*DEPRECATED*!], will be removed in next major release)
5318
- * specify where the template should be inserted. Defaults to `false`.
5342
+ * specify what the template should replace. Defaults to `false`.
5319
5343
  *
5320
- * * `true` - the template will replace the current element.
5321
- * * `false` - the template will replace the contents of the current element.
5344
+ * * `true` - the template will replace the directive's element.
5345
+ * * `false` - the template will replace the contents of the directive's element.
5322
5346
  *
5347
+ * The replacement process migrates all of the attributes / classes from the old element to the new
5348
+ * one. See the {@link guide/directive#creating-custom-directives_creating-directives_template-expanding-directive
5349
+ * Directives Guide} for an example.
5323
5350
  *
5324
5351
  * #### `transclude`
5325
5352
  * compile the content of the element and make it available to the directive.
@@ -5333,6 +5360,11 @@ function $TemplateCacheProvider() {
5333
5360
  * * `true` - transclude the content of the directive.
5334
5361
  * * `'element'` - transclude the whole element including any directives defined at lower priority.
5335
5362
  *
5363
+ * <div class="alert alert-warning">
5364
+ * **Note:** When testing an element transclude directive you must not place the directive at the root of the
5365
+ * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives
5366
+ * Testing Transclusion Directives}.
5367
+ * </div>
5336
5368
  *
5337
5369
  * #### `compile`
5338
5370
  *
@@ -5978,7 +6010,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
5978
6010
  : null;
5979
6011
 
5980
6012
  if (nodeLinkFn && nodeLinkFn.scope) {
5981
- safeAddClass(jqLite(nodeList[i]), 'ng-scope');
6013
+ safeAddClass(attrs.$$element, 'ng-scope');
5982
6014
  }
5983
6015
 
5984
6016
  childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
@@ -6000,7 +6032,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6000
6032
  return linkFnFound ? compositeLinkFn : null;
6001
6033
 
6002
6034
  function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
6003
- var nodeLinkFn, childLinkFn, node, $node, childScope, i, ii, n, childBoundTranscludeFn;
6035
+ var nodeLinkFn, childLinkFn, node, childScope, i, ii, n, childBoundTranscludeFn;
6004
6036
 
6005
6037
  // copy nodeList so that linking doesn't break due to live list updates.
6006
6038
  var nodeListLength = nodeList.length,
@@ -6013,12 +6045,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6013
6045
  node = stableNodeList[n];
6014
6046
  nodeLinkFn = linkFns[i++];
6015
6047
  childLinkFn = linkFns[i++];
6016
- $node = jqLite(node);
6017
6048
 
6018
6049
  if (nodeLinkFn) {
6019
6050
  if (nodeLinkFn.scope) {
6020
6051
  childScope = scope.$new();
6021
- $node.data('$scope', childScope);
6052
+ jqLite.data(node, '$scope', childScope);
6022
6053
  } else {
6023
6054
  childScope = scope;
6024
6055
  }
@@ -6310,12 +6341,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6310
6341
  if (directiveValue == 'element') {
6311
6342
  hasElementTranscludeDirective = true;
6312
6343
  terminalPriority = directive.priority;
6313
- $template = groupScan(compileNode, attrStart, attrEnd);
6344
+ $template = $compileNode;
6314
6345
  $compileNode = templateAttrs.$$element =
6315
6346
  jqLite(document.createComment(' ' + directiveName + ': ' +
6316
6347
  templateAttrs[directiveName] + ' '));
6317
6348
  compileNode = $compileNode[0];
6318
- replaceWith(jqCollection, jqLite(sliceArgs($template)), compileNode);
6349
+ replaceWith(jqCollection, sliceArgs($template), compileNode);
6319
6350
 
6320
6351
  childTranscludeFn = compile($template, transcludeFn, terminalPriority,
6321
6352
  replaceDirective && replaceDirective.name, {
@@ -6492,29 +6523,26 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6492
6523
  function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
6493
6524
  var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;
6494
6525
 
6495
- if (compileNode === linkNode) {
6496
- attrs = templateAttrs;
6497
- } else {
6498
- attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
6499
- }
6526
+ attrs = (compileNode === linkNode)
6527
+ ? templateAttrs
6528
+ : shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
6500
6529
  $element = attrs.$$element;
6501
6530
 
6502
6531
  if (newIsolateScopeDirective) {
6503
6532
  var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
6504
- var $linkNode = jqLite(linkNode);
6505
6533
 
6506
6534
  isolateScope = scope.$new(true);
6507
6535
 
6508
6536
  if (templateDirective && (templateDirective === newIsolateScopeDirective ||
6509
6537
  templateDirective === newIsolateScopeDirective.$$originalDirective)) {
6510
- $linkNode.data('$isolateScope', isolateScope) ;
6538
+ $element.data('$isolateScope', isolateScope);
6511
6539
  } else {
6512
- $linkNode.data('$isolateScopeNoTemplate', isolateScope);
6540
+ $element.data('$isolateScopeNoTemplate', isolateScope);
6513
6541
  }
6514
6542
 
6515
6543
 
6516
6544
 
6517
- safeAddClass($linkNode, 'ng-isolate-scope');
6545
+ safeAddClass($element, 'ng-isolate-scope');
6518
6546
 
6519
6547
  forEach(newIsolateScopeDirective.scope, function(definition, scopeName) {
6520
6548
  var match = definition.match(LOCAL_REGEXP) || [],
@@ -7318,11 +7346,7 @@ function parseHeaders(headers) {
7318
7346
  val = trim(line.substr(i + 1));
7319
7347
 
7320
7348
  if (key) {
7321
- if (parsed[key]) {
7322
- parsed[key] += ', ' + val;
7323
- } else {
7324
- parsed[key] = val;
7325
- }
7349
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
7326
7350
  }
7327
7351
  });
7328
7352
 
@@ -8159,7 +8183,7 @@ function $HttpProvider() {
8159
8183
  * Shortcut method to perform `JSONP` request.
8160
8184
  *
8161
8185
  * @param {string} url Relative or absolute URL specifying the destination of the request.
8162
- * Should contain `JSON_CALLBACK` string.
8186
+ * The name of the callback should be the string `JSON_CALLBACK`.
8163
8187
  * @param {Object=} config Optional configuration object
8164
8188
  * @returns {HttpPromise} Future object
8165
8189
  */
@@ -8259,7 +8283,7 @@ function $HttpProvider() {
8259
8283
  if (cache) {
8260
8284
  cachedResp = cache.get(url);
8261
8285
  if (isDefined(cachedResp)) {
8262
- if (cachedResp.then) {
8286
+ if (isPromiseLike(cachedResp)) {
8263
8287
  // cached request has already been sent, but there is no response yet
8264
8288
  cachedResp.then(removePendingReq, removePendingReq);
8265
8289
  return cachedResp;
@@ -8341,27 +8365,29 @@ function $HttpProvider() {
8341
8365
 
8342
8366
 
8343
8367
  function buildUrl(url, params) {
8344
- if (!params) return url;
8345
- var parts = [];
8346
- forEachSorted(params, function(value, key) {
8347
- if (value === null || isUndefined(value)) return;
8348
- if (!isArray(value)) value = [value];
8349
-
8350
- forEach(value, function(v) {
8351
- if (isObject(v)) {
8352
- v = toJson(v);
8353
- }
8354
- parts.push(encodeUriQuery(key) + '=' +
8355
- encodeUriQuery(v));
8356
- });
8357
- });
8358
- if(parts.length > 0) {
8359
- url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
8368
+ if (!params) return url;
8369
+ var parts = [];
8370
+ forEachSorted(params, function(value, key) {
8371
+ if (value === null || isUndefined(value)) return;
8372
+ if (!isArray(value)) value = [value];
8373
+
8374
+ forEach(value, function(v) {
8375
+ if (isObject(v)) {
8376
+ if (isDate(v)){
8377
+ v = v.toISOString();
8378
+ } else if (isObject(v)) {
8379
+ v = toJson(v);
8380
+ }
8360
8381
  }
8361
- return url;
8362
- }
8363
-
8364
-
8382
+ parts.push(encodeUriQuery(key) + '=' +
8383
+ encodeUriQuery(v));
8384
+ });
8385
+ });
8386
+ if(parts.length > 0) {
8387
+ url += ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&');
8388
+ }
8389
+ return url;
8390
+ }
8365
8391
  }];
8366
8392
  }
8367
8393
 
@@ -8497,7 +8523,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
8497
8523
 
8498
8524
  if (timeout > 0) {
8499
8525
  var timeoutId = $browserDefer(timeoutRequest, timeout);
8500
- } else if (timeout && timeout.then) {
8526
+ } else if (isPromiseLike(timeout)) {
8501
8527
  timeout.then(timeoutRequest);
8502
8528
  }
8503
8529
 
@@ -8910,7 +8936,7 @@ function $IntervalProvider() {
8910
8936
  * // Make sure that the interval nis destroyed too
8911
8937
  * $scope.stopFight();
8912
8938
  * });
8913
- * })
8939
+ * }])
8914
8940
  * // Register the 'myCurrentTime' directive factory method.
8915
8941
  * // We inject $interval and dateFilter service since the factory method is DI.
8916
8942
  * .directive('myCurrentTime', ['$interval', 'dateFilter',
@@ -8939,7 +8965,7 @@ function $IntervalProvider() {
8939
8965
  * $interval.cancel(stopTime);
8940
8966
  * });
8941
8967
  * }
8942
- * });
8968
+ * }]);
8943
8969
  * </script>
8944
8970
  *
8945
8971
  * <div>
@@ -10368,11 +10394,7 @@ Lexer.prototype = {
10368
10394
  string += String.fromCharCode(parseInt(hex, 16));
10369
10395
  } else {
10370
10396
  var rep = ESCAPE[ch];
10371
- if (rep) {
10372
- string += rep;
10373
- } else {
10374
- string += ch;
10375
- }
10397
+ string = string + (rep || ch);
10376
10398
  }
10377
10399
  escape = false;
10378
10400
  } else if (ch === '\\') {
@@ -11551,7 +11573,7 @@ function qFactory(nextTick, exceptionHandler) {
11551
11573
  } catch(e) {
11552
11574
  return makePromise(e, false);
11553
11575
  }
11554
- if (callbackOutput && isFunction(callbackOutput.then)) {
11576
+ if (isPromiseLike(callbackOutput)) {
11555
11577
  return callbackOutput.then(function() {
11556
11578
  return makePromise(value, isResolved);
11557
11579
  }, function(error) {
@@ -11576,7 +11598,7 @@ function qFactory(nextTick, exceptionHandler) {
11576
11598
 
11577
11599
 
11578
11600
  var ref = function(value) {
11579
- if (value && isFunction(value.then)) return value;
11601
+ if (isPromiseLike(value)) return value;
11580
11602
  return {
11581
11603
  then: function(callback) {
11582
11604
  var result = defer();
@@ -12243,7 +12265,7 @@ function $RootScopeProvider(){
12243
12265
 
12244
12266
  function $watchCollectionWatch() {
12245
12267
  newValue = objGetter(self);
12246
- var newLength, key;
12268
+ var newLength, key, bothNaN;
12247
12269
 
12248
12270
  if (!isObject(newValue)) { // if primitive
12249
12271
  if (oldValue !== newValue) {
@@ -12267,7 +12289,7 @@ function $RootScopeProvider(){
12267
12289
  }
12268
12290
  // copy the items to oldValue and look for changes.
12269
12291
  for (var i = 0; i < newLength; i++) {
12270
- var bothNaN = (oldValue[i] !== oldValue[i]) &&
12292
+ bothNaN = (oldValue[i] !== oldValue[i]) &&
12271
12293
  (newValue[i] !== newValue[i]);
12272
12294
  if (!bothNaN && (oldValue[i] !== newValue[i])) {
12273
12295
  changeDetected++;
@@ -12287,7 +12309,9 @@ function $RootScopeProvider(){
12287
12309
  if (newValue.hasOwnProperty(key)) {
12288
12310
  newLength++;
12289
12311
  if (oldValue.hasOwnProperty(key)) {
12290
- if (oldValue[key] !== newValue[key]) {
12312
+ bothNaN = (oldValue[key] !== oldValue[key]) &&
12313
+ (newValue[key] !== newValue[key]);
12314
+ if (!bothNaN && (oldValue[key] !== newValue[key])) {
12291
12315
  changeDetected++;
12292
12316
  oldValue[key] = newValue[key];
12293
12317
  }
@@ -14400,6 +14424,17 @@ function $WindowProvider(){
14400
14424
  this.$get = valueFn(window);
14401
14425
  }
14402
14426
 
14427
+ /* global currencyFilter: true,
14428
+ dateFilter: true,
14429
+ filterFilter: true,
14430
+ jsonFilter: true,
14431
+ limitToFilter: true,
14432
+ lowercaseFilter: true,
14433
+ numberFilter: true,
14434
+ orderByFilter: true,
14435
+ uppercaseFilter: true,
14436
+ */
14437
+
14403
14438
  /**
14404
14439
  * @ngdoc provider
14405
14440
  * @name $filterProvider
@@ -15161,11 +15196,7 @@ function dateFilter($locale) {
15161
15196
  format = format || 'mediumDate';
15162
15197
  format = $locale.DATETIME_FORMATS[format] || format;
15163
15198
  if (isString(date)) {
15164
- if (NUMBER_STRING.test(date)) {
15165
- date = int(date);
15166
- } else {
15167
- date = jsonStringToDate(date);
15168
- }
15199
+ date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date);
15169
15200
  }
15170
15201
 
15171
15202
  if (isNumber(date)) {
@@ -15440,7 +15471,7 @@ function limitToFilter(){
15440
15471
  * @example
15441
15472
  <example module="orderByExample">
15442
15473
  <file name="index.html">
15443
- <div ng-controller="Ctrl">
15474
+ <div ng-controller="ExampleController">
15444
15475
  <table class="friend">
15445
15476
  <tr>
15446
15477
  <th><a href="" ng-click="reverse=false;order('name', false)">Name</a>
@@ -15521,6 +15552,10 @@ function orderByFilter($parse){
15521
15552
  var t1 = typeof v1;
15522
15553
  var t2 = typeof v2;
15523
15554
  if (t1 == t2) {
15555
+ if (isDate(v1) && isDate(v2)) {
15556
+ v1 = v1.valueOf();
15557
+ v2 = v2.valueOf();
15558
+ }
15524
15559
  if (t1 == "string") {
15525
15560
  v1 = v1.toLowerCase();
15526
15561
  v2 = v2.toLowerCase();
@@ -16414,12 +16449,10 @@ var formDirectiveFactory = function(isNgForm) {
16414
16449
  var formDirective = formDirectiveFactory();
16415
16450
  var ngFormDirective = formDirectiveFactory(true);
16416
16451
 
16417
- /* global
16418
-
16419
- -VALID_CLASS,
16420
- -INVALID_CLASS,
16421
- -PRISTINE_CLASS,
16422
- -DIRTY_CLASS
16452
+ /* global VALID_CLASS: true,
16453
+ INVALID_CLASS: true,
16454
+ PRISTINE_CLASS: true,
16455
+ DIRTY_CLASS: true
16423
16456
  */
16424
16457
 
16425
16458
  var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
@@ -18064,7 +18097,7 @@ var ngValueDirective = function() {
18064
18097
  * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
18065
18098
  * `{{ expression }}` which is similar but less verbose.
18066
18099
  *
18067
- * It is preferable to use `ngBind` instead of `{{ expression }}` when a template is momentarily
18100
+ * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily
18068
18101
  * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
18069
18102
  * element attribute, it makes the bindings invisible to the user while the page is loading.
18070
18103
  *
@@ -18228,15 +18261,24 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
18228
18261
  </example>
18229
18262
  */
18230
18263
  var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) {
18231
- return function(scope, element, attr) {
18232
- element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
18264
+ return {
18265
+ compile: function (tElement) {
18266
+ tElement.addClass('ng-binding');
18233
18267
 
18234
- var parsed = $parse(attr.ngBindHtml);
18235
- function getStringValue() { return (parsed(scope) || '').toString(); }
18268
+ return function (scope, element, attr) {
18269
+ element.data('$binding', attr.ngBindHtml);
18236
18270
 
18237
- scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) {
18238
- element.html($sce.getTrustedHtml(parsed(scope)) || '');
18239
- });
18271
+ var parsed = $parse(attr.ngBindHtml);
18272
+
18273
+ function getStringValue() {
18274
+ return (parsed(scope) || '').toString();
18275
+ }
18276
+
18277
+ scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) {
18278
+ element.html($sce.getTrustedHtml(parsed(scope)) || '');
18279
+ });
18280
+ };
18281
+ }
18240
18282
  };
18241
18283
  }];
18242
18284
 
@@ -18899,8 +18941,10 @@ var ngControllerDirective = [function() {
18899
18941
  * This is necessary when developing things like Google Chrome Extensions.
18900
18942
  *
18901
18943
  * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
18902
- * For us to be compatible, we just need to implement the "getterFn" in $parse without violating
18903
- * any of these restrictions.
18944
+ * For Angular to be CSP compatible there are only two things that we need to do differently:
18945
+ *
18946
+ * - don't use `Function` constructor to generate optimized value getters
18947
+ * - don't inject custom stylesheet into the document
18904
18948
  *
18905
18949
  * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp`
18906
18950
  * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will
@@ -18911,7 +18955,18 @@ var ngControllerDirective = [function() {
18911
18955
  * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}).
18912
18956
  * To make those directives work in CSP mode, include the `angular-csp.css` manually.
18913
18957
  *
18914
- * In order to use this feature put the `ngCsp` directive on the root element of the application.
18958
+ * Angular tries to autodetect if CSP is active and automatically turn on the CSP-safe mode. This
18959
+ * autodetection however triggers a CSP error to be logged in the console:
18960
+ *
18961
+ * ```
18962
+ * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
18963
+ * script in the following Content Security Policy directive: "default-src 'self'". Note that
18964
+ * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
18965
+ * ```
18966
+ *
18967
+ * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
18968
+ * directive on the root element of the application or on the `angular.js` script tag, whichever
18969
+ * appears first in the html document.
18915
18970
  *
18916
18971
  * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
18917
18972
  *
@@ -18926,9 +18981,9 @@ var ngControllerDirective = [function() {
18926
18981
  ```
18927
18982
  */
18928
18983
 
18929
- // ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap
18930
- // the system (before $parse is instantiated), for this reason we just have a csp() fn that looks for ng-csp attribute
18931
- // anywhere in the current doc
18984
+ // ngCsp is not implemented as a proper directive any more, because we need it be processed while we
18985
+ // bootstrap the system (before $parse is instantiated), for this reason we just have
18986
+ // the csp.isActive() fn that looks for ng-csp attribute anywhere in the current doc
18932
18987
 
18933
18988
  /**
18934
18989
  * @ngdoc directive
@@ -21699,6 +21754,12 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
21699
21754
  // lastElement.prop('selected') provided by jQuery has side-effects
21700
21755
  if (existingOption.selected !== option.selected) {
21701
21756
  lastElement.prop('selected', (existingOption.selected = option.selected));
21757
+ if (msie) {
21758
+ // See #7692
21759
+ // The selected item wouldn't visually update on IE without this.
21760
+ // Tested on Win7: IE9, IE10 and IE11. Future IEs should be tested as well
21761
+ lastElement.prop('selected', existingOption.selected);
21762
+ }
21702
21763
  }
21703
21764
  } else {
21704
21765
  // grow elements