angularjs-rails 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  module AngularJS
2
2
  module Rails
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -10,10 +10,10 @@ var directive = {};
10
10
  var service = { value: {} };
11
11
 
12
12
  var DEPENDENCIES = {
13
- 'angular.js': 'http://code.angularjs.org/' + angular.version.full + 'angular.min.js',
14
- 'angular-resource.js': 'http://code.angularjs.org/' + angular.version.full + 'angular-resource.min.js',
15
- 'angular-sanitize.js': 'http://code.angularjs.org/' + angular.version.full + 'angular-sanitize.min.js',
16
- 'angular-cookies.js': 'http://code.angularjs.org/' + angular.version.full + 'angular-cookies.min.js'
13
+ 'angular.js': 'http://code.angularjs.org/' + angular.version.full + '/angular.min.js',
14
+ 'angular-resource.js': 'http://code.angularjs.org/' + angular.version.full + '/angular-resource.min.js',
15
+ 'angular-sanitize.js': 'http://code.angularjs.org/' + angular.version.full + '/angular-sanitize.min.js',
16
+ 'angular-cookies.js': 'http://code.angularjs.org/' + angular.version.full + '/angular-cookies.min.js'
17
17
  };
18
18
 
19
19
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -25,6 +25,18 @@ angular.module('ngCookies', ['ng']).
25
25
  * this object, new cookies are created/deleted at the end of current $eval.
26
26
  *
27
27
  * @example
28
+ <doc:example>
29
+ <doc:source>
30
+ <script>
31
+ function ExampleController($cookies) {
32
+ // Retrieving a cookie
33
+ var favoriteCookie = $cookies.myFavorite;
34
+ // Setting a cookie
35
+ $cookies.myFavorite = 'oatmeal';
36
+ }
37
+ </script>
38
+ </doc:source>
39
+ </doc:example>
28
40
  */
29
41
  factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
30
42
  var cookies = {},
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -69,9 +69,9 @@
69
69
  *
70
70
  * Calling these methods invoke an {@link ng.$http} with the specified http method,
71
71
  * destination and parameters. When the data is returned from the server then the object is an
72
- * instance of the resource class `save`, `remove` and `delete` actions are available on it as
73
- * methods with the `$` prefix. This allows you to easily perform CRUD operations (create, read,
74
- * update, delete) on server-side data like this:
72
+ * instance of the resource class. The actions `save`, `remove` and `delete` are available on it
73
+ * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
74
+ * read, update, delete) on server-side data like this:
75
75
  * <pre>
76
76
  var User = $resource('/user/:userId', {userId:'@id'});
77
77
  var user = User.get({userId:123}, function() {
@@ -151,9 +151,9 @@
151
151
  });
152
152
  </pre>
153
153
  *
154
- * It's worth noting that the success callback for `get`, `query` and other method gets passed
155
- * in the response that came from the server as well as $http header getter function, so one
156
- * could rewrite the above example and get access to http headers as:
154
+ * It's worth noting that the success callback for `get`, `query` and other method gets passed
155
+ * in the response that came from the server as well as $http header getter function, so one
156
+ * could rewrite the above example and get access to http headers as:
157
157
  *
158
158
  <pre>
159
159
  var User = $resource('/user/:userId', {userId:'@id'});
@@ -276,7 +276,7 @@ angular.module('ngResource', ['ng']).
276
276
  this.defaults = defaults || {};
277
277
  var urlParams = this.urlParams = {};
278
278
  forEach(template.split(/\W/), function(param){
279
- if (param && template.match(new RegExp("[^\\\\]:" + param + "\\W"))) {
279
+ if (param && (new RegExp("(^|[^\\\\]):" + param + "\\W").test(template))) {
280
280
  urlParams[param] = true;
281
281
  }
282
282
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.4
2
+ * @license AngularJS v1.0.5
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -9404,7 +9404,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
9404
9404
 
9405
9405
  })( window );
9406
9406
  /**
9407
- * @license AngularJS v1.0.4
9407
+ * @license AngularJS v1.0.5
9408
9408
  * (c) 2010-2012 Google, Inc. http://angularjs.org
9409
9409
  * License: MIT
9410
9410
  */
@@ -9460,8 +9460,7 @@ if ('i' !== 'I'.toLowerCase()) {
9460
9460
  function fromCharCode(code) {return String.fromCharCode(code);}
9461
9461
 
9462
9462
 
9463
- var Error = window.Error,
9464
- /** holds major version number for IE or NaN for real browsers */
9463
+ var /** holds major version number for IE or NaN for real browsers */
9465
9464
  msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
9466
9465
  jqLite, // delay binding since jQuery could be loaded after us.
9467
9466
  jQuery, // delay binding
@@ -9502,6 +9501,30 @@ var Error = window.Error,
9502
9501
  * @param {Object=} context Object to become context (`this`) for the iterator function.
9503
9502
  * @returns {Object|Array} Reference to `obj`.
9504
9503
  */
9504
+
9505
+
9506
+ /**
9507
+ * @private
9508
+ * @param {*} obj
9509
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
9510
+ */
9511
+ function isArrayLike(obj) {
9512
+ if (!obj || (typeof obj.length !== 'number')) return false;
9513
+
9514
+ // We have on object which has length property. Should we treat it as array?
9515
+ if (typeof obj.hasOwnProperty != 'function' &&
9516
+ typeof obj.constructor != 'function') {
9517
+ // This is here for IE8: it is a bogus object treat it as array;
9518
+ return true;
9519
+ } else {
9520
+ return obj instanceof JQLite || // JQLite
9521
+ (jQuery && obj instanceof jQuery) || // jQuery
9522
+ toString.call(obj) !== '[object Object]' || // some browser native object
9523
+ typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
9524
+ }
9525
+ }
9526
+
9527
+
9505
9528
  function forEach(obj, iterator, context) {
9506
9529
  var key;
9507
9530
  if (obj) {
@@ -9513,7 +9536,7 @@ function forEach(obj, iterator, context) {
9513
9536
  }
9514
9537
  } else if (obj.forEach && obj.forEach !== forEach) {
9515
9538
  obj.forEach(iterator, context);
9516
- } else if (isObject(obj) && isNumber(obj.length)) {
9539
+ } else if (isArrayLike(obj)) {
9517
9540
  for (key = 0; key < obj.length; key++)
9518
9541
  iterator.call(context, obj[key], key);
9519
9542
  } else {
@@ -9558,7 +9581,7 @@ function reverseParams(iteratorFn) {
9558
9581
  /**
9559
9582
  * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
9560
9583
  * characters such as '012ABC'. The reason why we are not using simply a number counter is that
9561
- * the number string gets longer over time, and it can also overflow, where as the the nextId
9584
+ * the number string gets longer over time, and it can also overflow, where as the nextId
9562
9585
  * will grow much slower, it is a string, and it will never overflow.
9563
9586
  *
9564
9587
  * @returns an unique alpha-numeric string
@@ -9954,9 +9977,7 @@ function copy(source, destination){
9954
9977
  } else {
9955
9978
  if (source === destination) throw Error("Can't copy equivalent objects or arrays");
9956
9979
  if (isArray(source)) {
9957
- while(destination.length) {
9958
- destination.pop();
9959
- }
9980
+ destination.length = 0;
9960
9981
  for ( var i = 0; i < source.length; i++) {
9961
9982
  destination.push(copy(source[i]));
9962
9983
  }
@@ -10167,9 +10188,18 @@ function startingTag(element) {
10167
10188
  // are not allowed to have children. So we just ignore it.
10168
10189
  element.html('');
10169
10190
  } catch(e) {}
10170
- return jqLite('<div>').append(element).html().
10171
- match(/^(<[^>]+>)/)[1].
10172
- replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
10191
+ // As Per DOM Standards
10192
+ var TEXT_NODE = 3;
10193
+ var elemHtml = jqLite('<div>').append(element).html();
10194
+ try {
10195
+ return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :
10196
+ elemHtml.
10197
+ match(/^(<[^>]+>)/)[1].
10198
+ replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
10199
+ } catch(e) {
10200
+ return lowercase(elemHtml);
10201
+ }
10202
+
10173
10203
  }
10174
10204
 
10175
10205
 
@@ -10253,7 +10283,7 @@ function encodeUriQuery(val, pctEncodeSpaces) {
10253
10283
  * Use this directive to auto-bootstrap on application. Only
10254
10284
  * one directive can be used per HTML document. The directive
10255
10285
  * designates the root of the application and is typically placed
10256
- * ot the root of the page.
10286
+ * at the root of the page.
10257
10287
  *
10258
10288
  * In the example below if the `ngApp` directive would not be placed
10259
10289
  * on the `html` element then the document would not be compiled
@@ -10654,11 +10684,11 @@ function setupModuleLoader(window) {
10654
10684
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
10655
10685
  */
10656
10686
  var version = {
10657
- full: '1.0.4', // all of these placeholder strings will be replaced by rake's
10687
+ full: '1.0.5', // all of these placeholder strings will be replaced by rake's
10658
10688
  major: 1, // compile task
10659
10689
  minor: 0,
10660
- dot: 4,
10661
- codeName: 'bewildering-hair'
10690
+ dot: 5,
10691
+ codeName: 'flatulent-propulsion'
10662
10692
  };
10663
10693
 
10664
10694
 
@@ -11835,7 +11865,7 @@ function annotate(fn) {
11835
11865
  * This method does not work with code minfication / obfuscation. For this reason the following annotation strategies
11836
11866
  * are supported.
11837
11867
  *
11838
- * # The `$injector` property
11868
+ * # The `$inject` property
11839
11869
  *
11840
11870
  * If a function has an `$inject` property and its value is an array of strings, then the strings represent names of
11841
11871
  * services to be injected into the function.
@@ -12549,7 +12579,7 @@ function Browser(window, document, $log, $sniffer) {
12549
12579
  */
12550
12580
  self.baseHref = function() {
12551
12581
  var href = baseElement.attr('href');
12552
- return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;
12582
+ return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : '';
12553
12583
  };
12554
12584
 
12555
12585
  //////////////////////////////////////////////////////////////
@@ -12999,7 +13029,8 @@ function $CompileProvider($provide) {
12999
13029
  Suffix = 'Directive',
13000
13030
  COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
13001
13031
  CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
13002
- MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ';
13032
+ MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ',
13033
+ urlSanitizationWhitelist = /^\s*(https?|ftp|mailto):/;
13003
13034
 
13004
13035
 
13005
13036
  /**
@@ -13053,11 +13084,41 @@ function $CompileProvider($provide) {
13053
13084
  };
13054
13085
 
13055
13086
 
13087
+ /**
13088
+ * @ngdoc function
13089
+ * @name ng.$compileProvider#urlSanitizationWhitelist
13090
+ * @methodOf ng.$compileProvider
13091
+ * @function
13092
+ *
13093
+ * @description
13094
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
13095
+ * urls during a[href] sanitization.
13096
+ *
13097
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
13098
+ *
13099
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into an
13100
+ * absolute url. Afterwards the url is matched against the `urlSanitizationWhitelist` regular
13101
+ * expression. If a match is found the original url is written into the dom. Otherwise the
13102
+ * absolute url is prefixed with `'unsafe:'` string and only then it is written into the DOM.
13103
+ *
13104
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
13105
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
13106
+ * chaining otherwise.
13107
+ */
13108
+ this.urlSanitizationWhitelist = function(regexp) {
13109
+ if (isDefined(regexp)) {
13110
+ urlSanitizationWhitelist = regexp;
13111
+ return this;
13112
+ }
13113
+ return urlSanitizationWhitelist;
13114
+ };
13115
+
13116
+
13056
13117
  this.$get = [
13057
13118
  '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
13058
- '$controller', '$rootScope',
13119
+ '$controller', '$rootScope', '$document',
13059
13120
  function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse,
13060
- $controller, $rootScope) {
13121
+ $controller, $rootScope, $document) {
13061
13122
 
13062
13123
  var Attributes = function(element, attr) {
13063
13124
  this.$$element = element;
@@ -13079,7 +13140,8 @@ function $CompileProvider($provide) {
13079
13140
  */
13080
13141
  $set: function(key, value, writeAttr, attrName) {
13081
13142
  var booleanKey = getBooleanAttrName(this.$$element[0], key),
13082
- $$observers = this.$$observers;
13143
+ $$observers = this.$$observers,
13144
+ normalizedVal;
13083
13145
 
13084
13146
  if (booleanKey) {
13085
13147
  this.$$element.prop(key, value);
@@ -13098,6 +13160,19 @@ function $CompileProvider($provide) {
13098
13160
  }
13099
13161
  }
13100
13162
 
13163
+
13164
+ // sanitize a[href] values
13165
+ if (nodeName_(this.$$element[0]) === 'A' && key === 'href') {
13166
+ urlSanitizationNode.setAttribute('href', value);
13167
+
13168
+ // href property always returns normalized absolute url, so we can match against that
13169
+ normalizedVal = urlSanitizationNode.href;
13170
+ if (!normalizedVal.match(urlSanitizationWhitelist)) {
13171
+ this[key] = value = 'unsafe:' + normalizedVal;
13172
+ }
13173
+ }
13174
+
13175
+
13101
13176
  if (writeAttr !== false) {
13102
13177
  if (value === null || value === undefined) {
13103
13178
  this.$$element.removeAttr(attrName);
@@ -13141,7 +13216,8 @@ function $CompileProvider($provide) {
13141
13216
  }
13142
13217
  };
13143
13218
 
13144
- var startSymbol = $interpolate.startSymbol(),
13219
+ var urlSanitizationNode = $document[0].createElement('a'),
13220
+ startSymbol = $interpolate.startSymbol(),
13145
13221
  endSymbol = $interpolate.endSymbol(),
13146
13222
  denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
13147
13223
  ? identity
@@ -13174,7 +13250,14 @@ function $CompileProvider($provide) {
13174
13250
  var $linkNode = cloneConnectFn
13175
13251
  ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
13176
13252
  : $compileNodes;
13177
- $linkNode.data('$scope', scope);
13253
+
13254
+ // Attach scope only to non-text nodes.
13255
+ for(var i = 0, ii = $linkNode.length; i<ii; i++) {
13256
+ var node = $linkNode[i];
13257
+ if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) {
13258
+ $linkNode.eq(i).data('$scope', scope);
13259
+ }
13260
+ }
13178
13261
  safeAddClass($linkNode, 'ng-scope');
13179
13262
  if (cloneConnectFn) cloneConnectFn($linkNode, scope);
13180
13263
  if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
@@ -13264,6 +13347,7 @@ function $CompileProvider($provide) {
13264
13347
  (function(transcludeFn) {
13265
13348
  return function(cloneFn) {
13266
13349
  var transcludeScope = scope.$new();
13350
+ transcludeScope.$$transcluded = true;
13267
13351
 
13268
13352
  return transcludeFn(transcludeScope, cloneFn).
13269
13353
  bind('$destroy', bind(transcludeScope, transcludeScope.$destroy));
@@ -13569,6 +13653,8 @@ function $CompileProvider($provide) {
13569
13653
  lastValue,
13570
13654
  parentGet, parentSet;
13571
13655
 
13656
+ scope.$$isolateBindings[scopeName] = mode + attrName;
13657
+
13572
13658
  switch (mode) {
13573
13659
 
13574
13660
  case '@': {
@@ -13779,7 +13865,7 @@ function $CompileProvider($provide) {
13779
13865
  }
13780
13866
 
13781
13867
  directives.unshift(derivedSyncDirective);
13782
- afterTemplateNodeLinkFn = applyDirectivesToNode(directives, $compileNode, tAttrs, childTranscludeFn);
13868
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn);
13783
13869
  afterTemplateChildLinkFn = compileNodes($compileNode.contents(), childTranscludeFn);
13784
13870
 
13785
13871
 
@@ -13859,10 +13945,10 @@ function $CompileProvider($provide) {
13859
13945
  function addAttrInterpolateDirective(node, directives, value, name) {
13860
13946
  var interpolateFn = $interpolate(value, true);
13861
13947
 
13862
-
13863
13948
  // no interpolation found -> ignore
13864
13949
  if (!interpolateFn) return;
13865
13950
 
13951
+
13866
13952
  directives.push({
13867
13953
  priority: 100,
13868
13954
  compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) {
@@ -15856,9 +15942,10 @@ function getterFn(path, csp) {
15856
15942
  * @param {string} expression String expression to compile.
15857
15943
  * @returns {function(context, locals)} a function which represents the compiled expression:
15858
15944
  *
15859
- * * `context`: an object against which any expressions embedded in the strings are evaluated
15860
- * against (Topically a scope object).
15861
- * * `locals`: local variables context object, useful for overriding values in `context`.
15945
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
15946
+ * are evaluated against (tipically a scope object).
15947
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
15948
+ * `context`.
15862
15949
  *
15863
15950
  * The return function also has an `assign` property, if the expression is assignable, which
15864
15951
  * allows one to set values to expressions.
@@ -15894,7 +15981,7 @@ function $ParseProvider() {
15894
15981
  * interface for interacting with an object that represents the result of an action that is
15895
15982
  * performed asynchronously, and may or may not be finished at any given point in time.
15896
15983
  *
15897
- * From the perspective of dealing with error handling, deferred and promise apis are to
15984
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
15898
15985
  * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
15899
15986
  *
15900
15987
  * <pre>
@@ -15929,7 +16016,7 @@ function $ParseProvider() {
15929
16016
  *
15930
16017
  * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
15931
16018
  * comes in the way of
15932
- * [guarantees that promise and deferred apis make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md).
16019
+ * [guarantees that promise and deferred APIs make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md).
15933
16020
  *
15934
16021
  * Additionally the promise api allows for composition that is very hard to do with the
15935
16022
  * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
@@ -15941,7 +16028,7 @@ function $ParseProvider() {
15941
16028
  *
15942
16029
  * A new instance of deferred is constructed by calling `$q.defer()`.
15943
16030
  *
15944
- * The purpose of the deferred object is to expose the associated Promise instance as well as apis
16031
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
15945
16032
  * that can be used for signaling the successful or unsuccessful completion of the task.
15946
16033
  *
15947
16034
  * **Methods**
@@ -15984,7 +16071,7 @@ function $ParseProvider() {
15984
16071
  * return result + 1;
15985
16072
  * });
15986
16073
  *
15987
- * // promiseB will be resolved immediately after promiseA is resolved and it's value will be
16074
+ * // promiseB will be resolved immediately after promiseA is resolved and its value will be
15988
16075
  * // the result of promiseA incremented by 1
15989
16076
  * </pre>
15990
16077
  *
@@ -16009,7 +16096,7 @@ function $ParseProvider() {
16009
16096
  * # Testing
16010
16097
  *
16011
16098
  * <pre>
16012
- * it('should simulate promise', inject(function($q, $rootSCope) {
16099
+ * it('should simulate promise', inject(function($q, $rootScope) {
16013
16100
  * var deferred = $q.defer();
16014
16101
  * var promise = deferred.promise;
16015
16102
  * var resolvedValue;
@@ -16018,7 +16105,7 @@ function $ParseProvider() {
16018
16105
  * expect(resolvedValue).toBeUndefined();
16019
16106
  *
16020
16107
  * // Simulate resolving of promise
16021
- * defered.resolve(123);
16108
+ * deferred.resolve(123);
16022
16109
  * // Note that the 'then' function does not get called synchronously.
16023
16110
  * // This is because we want the promise API to always be async, whether or not
16024
16111
  * // it got called synchronously or asynchronously.
@@ -16194,12 +16281,12 @@ function qFactory(nextTick, exceptionHandler) {
16194
16281
  * @methodOf ng.$q
16195
16282
  * @description
16196
16283
  * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
16197
- * This is useful when you are dealing with on object that might or might not be a promise, or if
16284
+ * This is useful when you are dealing with an object that might or might not be a promise, or if
16198
16285
  * the promise comes from a source that can't be trusted.
16199
16286
  *
16200
16287
  * @param {*} value Value or a promise
16201
16288
  * @returns {Promise} Returns a single promise that will be resolved with an array of values,
16202
- * each value coresponding to the promise at the same index in the `promises` array. If any of
16289
+ * each value corresponding to the promise at the same index in the `promises` array. If any of
16203
16290
  * the promises is resolved with a rejection, this resulting promise will be resolved with the
16204
16291
  * same rejection.
16205
16292
  */
@@ -16261,7 +16348,7 @@ function qFactory(nextTick, exceptionHandler) {
16261
16348
  *
16262
16349
  * @param {Array.<Promise>} promises An array of promises.
16263
16350
  * @returns {Promise} Returns a single promise that will be resolved with an array of values,
16264
- * each value coresponding to the promise at the same index in the `promises` array. If any of
16351
+ * each value corresponding to the promise at the same index in the `promises` array. If any of
16265
16352
  * the promises is resolved with a rejection, this resulting promise will be resolved with the
16266
16353
  * same rejection.
16267
16354
  */
@@ -16930,6 +17017,7 @@ function $RootScopeProvider(){
16930
17017
  this.$$destroyed = false;
16931
17018
  this.$$asyncQueue = [];
16932
17019
  this.$$listeners = {};
17020
+ this.$$isolateBindings = {};
16933
17021
  }
16934
17022
 
16935
17023
  /**
@@ -17411,10 +17499,6 @@ function $RootScopeProvider(){
17411
17499
  * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for discussion of
17412
17500
  * event life cycle.
17413
17501
  *
17414
- * @param {string} name Event name to listen on.
17415
- * @param {function(event)} listener Function to call when the event is emitted.
17416
- * @returns {function()} Returns a deregistration function for this listener.
17417
- *
17418
17502
  * The event listener function format is: `function(event, args...)`. The `event` object
17419
17503
  * passed into the listener has the following attributes:
17420
17504
  *
@@ -17425,6 +17509,10 @@ function $RootScopeProvider(){
17425
17509
  * propagation (available only for events that were `$emit`-ed).
17426
17510
  * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
17427
17511
  * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
17512
+ *
17513
+ * @param {string} name Event name to listen on.
17514
+ * @param {function(event, args...)} listener Function to call when the event is emitted.
17515
+ * @returns {function()} Returns a deregistration function for this listener.
17428
17516
  */
17429
17517
  $on: function(name, listener) {
17430
17518
  var namedListeners = this.$$listeners[name];
@@ -17602,7 +17690,7 @@ function $RootScopeProvider(){
17602
17690
 
17603
17691
  /**
17604
17692
  * function used as an initial value for watchers.
17605
- * because it's uniqueue we can easily tell it apart from other values
17693
+ * because it's unique we can easily tell it apart from other values
17606
17694
  */
17607
17695
  function initWatchVal() {}
17608
17696
  }];
@@ -18513,8 +18601,30 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
18513
18601
  // always async
18514
18602
  xhr.onreadystatechange = function() {
18515
18603
  if (xhr.readyState == 4) {
18516
- completeRequest(
18517
- callback, status || xhr.status, xhr.responseText, xhr.getAllResponseHeaders());
18604
+ var responseHeaders = xhr.getAllResponseHeaders();
18605
+
18606
+ // TODO(vojta): remove once Firefox 21 gets released.
18607
+ // begin: workaround to overcome Firefox CORS http response headers bug
18608
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=608735
18609
+ // Firefox already patched in nightly. Should land in Firefox 21.
18610
+
18611
+ // CORS "simple response headers" http://www.w3.org/TR/cors/
18612
+ var value,
18613
+ simpleHeaders = ["Cache-Control", "Content-Language", "Content-Type",
18614
+ "Expires", "Last-Modified", "Pragma"];
18615
+ if (!responseHeaders) {
18616
+ responseHeaders = "";
18617
+ forEach(simpleHeaders, function (header) {
18618
+ var value = xhr.getResponseHeader(header);
18619
+ if (value) {
18620
+ responseHeaders += header + ": " + value + "\n";
18621
+ }
18622
+ });
18623
+ }
18624
+ // end of the workaround.
18625
+
18626
+ completeRequest(callback, status || xhr.status, xhr.responseText,
18627
+ responseHeaders);
18518
18628
  }
18519
18629
  };
18520
18630
 
@@ -18913,7 +19023,7 @@ function $FilterProvider($provide) {
18913
19023
  */
18914
19024
  function filterFilter() {
18915
19025
  return function(array, expression) {
18916
- if (!(array instanceof Array)) return array;
19026
+ if (!isArray(array)) return array;
18917
19027
  var predicates = [];
18918
19028
  predicates.check = function(value) {
18919
19029
  for (var j = 0; j < predicates.length; j++) {
@@ -19162,7 +19272,7 @@ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
19162
19272
  fraction += '0';
19163
19273
  }
19164
19274
 
19165
- if (fractionSize) formatedText += decimalSep + fraction.substr(0, fractionSize);
19275
+ if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize);
19166
19276
  }
19167
19277
 
19168
19278
  parts.push(isNegative ? pattern.negPre : pattern.posPre);
@@ -19205,8 +19315,12 @@ function dateStrGetter(name, shortForm) {
19205
19315
  }
19206
19316
 
19207
19317
  function timeZoneGetter(date) {
19208
- var offset = date.getTimezoneOffset();
19209
- return padNumber(offset / 60, 2) + padNumber(Math.abs(offset % 60), 2);
19318
+ var zone = -1 * date.getTimezoneOffset();
19319
+ var paddedZone = (zone >= 0) ? "+" : "";
19320
+
19321
+ paddedZone += padNumber(zone / 60, 2) + padNumber(Math.abs(zone % 60), 2);
19322
+
19323
+ return paddedZone;
19210
19324
  }
19211
19325
 
19212
19326
  function ampmGetter(date, formats) {
@@ -19292,7 +19406,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
19292
19406
  *
19293
19407
  * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
19294
19408
  * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and it's
19295
- * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ).
19409
+ * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
19410
+ * specified in the string input, the time is considered to be in the local timezone.
19296
19411
  * @param {string=} format Formatting rules (see Description). If not specified,
19297
19412
  * `mediumDate` is used.
19298
19413
  * @returns {string} Formatted string or the input if input is not recognized as date/millis.
@@ -19312,7 +19427,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
19312
19427
  expect(binding("1288323623006 | date:'medium'")).
19313
19428
  toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
19314
19429
  expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).
19315
- toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} \-?\d{4}/);
19430
+ toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
19316
19431
  expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).
19317
19432
  toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
19318
19433
  });
@@ -19618,7 +19733,7 @@ function limitToFilter(){
19618
19733
  orderByFilter.$inject = ['$parse'];
19619
19734
  function orderByFilter($parse){
19620
19735
  return function(array, sortPredicate, reverseOrder) {
19621
- if (!(array instanceof Array)) return array;
19736
+ if (!isArray(array)) return array;
19622
19737
  if (!sortPredicate) return array;
19623
19738
  sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
19624
19739
  sortPredicate = map(sortPredicate, function(predicate){
@@ -19686,15 +19801,25 @@ function ngDirective(directive) {
19686
19801
  *
19687
19802
  * The reasoning for this change is to allow easy creation of action links with `ngClick` directive
19688
19803
  * without changing the location or causing page reloads, e.g.:
19689
- * <a href="" ng-click="model.$save()">Save</a>
19804
+ * `<a href="" ng-click="model.$save()">Save</a>`
19690
19805
  */
19691
19806
  var htmlAnchorDirective = valueFn({
19692
19807
  restrict: 'E',
19693
19808
  compile: function(element, attr) {
19694
- // turn <a href ng-click="..">link</a> into a link in IE
19695
- // but only if it doesn't have name attribute, in which case it's an anchor
19696
- if (!attr.href) {
19697
- attr.$set('href', '');
19809
+
19810
+ if (msie <= 8) {
19811
+
19812
+ // turn <a href ng-click="..">link</a> into a stylable link in IE
19813
+ // but only if it doesn't have name attribute, in which case it's an anchor
19814
+ if (!attr.href && !attr.name) {
19815
+ attr.$set('href', '');
19816
+ }
19817
+
19818
+ // add a comment node to anchors to workaround IE bug that causes element content to be reset
19819
+ // to new attribute content if attribute is updated with value containing @ and element also
19820
+ // contains value with @
19821
+ // see issue #1949
19822
+ element.append(document.createComment('IE fix'));
19698
19823
  }
19699
19824
 
19700
19825
  return function(scope, element) {
@@ -19774,7 +19899,7 @@ var htmlAnchorDirective = valueFn({
19774
19899
  it('should execute ng-click but not reload when no href but name specified', function() {
19775
19900
  element('#link-5').click();
19776
19901
  expect(input('value').val()).toEqual('5');
19777
- expect(element('#link-5').attr('href')).toBe('');
19902
+ expect(element('#link-5').attr('href')).toBe(undefined);
19778
19903
  });
19779
19904
 
19780
19905
  it('should only change url when only ng-href', function() {
@@ -20017,8 +20142,9 @@ forEach(['src', 'href'], function(attrName) {
20017
20142
 
20018
20143
  // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
20019
20144
  // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
20020
- // to set the property as well to achieve the desired effect
20021
- if (msie) element.prop(attrName, value);
20145
+ // to set the property as well to achieve the desired effect.
20146
+ // we use attr[attrName] value since $set can sanitize the url.
20147
+ if (msie) element.prop(attrName, attr[attrName]);
20022
20148
  });
20023
20149
  }
20024
20150
  };
@@ -21723,6 +21849,7 @@ var ngBindHtmlUnsafeDirective = [function() {
21723
21849
  function classDirective(name, selector) {
21724
21850
  name = 'ngClass' + name;
21725
21851
  return ngDirective(function(scope, element, attr) {
21852
+ var oldVal = undefined;
21726
21853
 
21727
21854
  scope.$watch(attr[name], ngClassWatchAction, true);
21728
21855
 
@@ -21746,13 +21873,14 @@ function classDirective(name, selector) {
21746
21873
  }
21747
21874
 
21748
21875
 
21749
- function ngClassWatchAction(newVal, oldVal) {
21876
+ function ngClassWatchAction(newVal) {
21750
21877
  if (selector === true || scope.$index % 2 === selector) {
21751
21878
  if (oldVal && (newVal !== oldVal)) {
21752
21879
  removeClass(oldVal);
21753
21880
  }
21754
21881
  addClass(newVal);
21755
21882
  }
21883
+ oldVal = newVal;
21756
21884
  }
21757
21885
 
21758
21886
 
@@ -21785,7 +21913,7 @@ function classDirective(name, selector) {
21785
21913
  *
21786
21914
  * The directive won't add duplicate classes if a particular class was already set.
21787
21915
  *
21788
- * When the expression changes, the previously added classes are removed and only then the classes
21916
+ * When the expression changes, the previously added classes are removed and only then the
21789
21917
  * new classes are added.
21790
21918
  *
21791
21919
  * @element ANY
@@ -23109,9 +23237,10 @@ var NG_SWITCH = 'ng-switch';
23109
23237
  var ngSwitchDirective = valueFn({
23110
23238
  restrict: 'EA',
23111
23239
  require: 'ngSwitch',
23112
- controller: function ngSwitchController() {
23240
+ // asks for $scope to fool the BC controller module
23241
+ controller: ['$scope', function ngSwitchController() {
23113
23242
  this.cases = {};
23114
- },
23243
+ }],
23115
23244
  link: function(scope, element, attr, ctrl) {
23116
23245
  var watchExpr = attr.ngSwitch || attr.on,
23117
23246
  selectedTransclude,
@@ -23362,7 +23491,7 @@ var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$c
23362
23491
  if (current.controller) {
23363
23492
  locals.$scope = lastScope;
23364
23493
  controller = $controller(current.controller, locals);
23365
- element.contents().data('$ngControllerController', controller);
23494
+ element.children().data('$ngControllerController', controller);
23366
23495
  }
23367
23496
 
23368
23497
  link(lastScope);
@@ -26027,7 +26156,7 @@ angular.scenario.output('xml', function(context, runner, model) {
26027
26156
  if (step.error) {
26028
26157
  var error = $('<error></error>');
26029
26158
  stepContext.append(error);
26030
- error.text(formatException(stepContext.error));
26159
+ error.text(formatException(step.error));
26031
26160
  }
26032
26161
  });
26033
26162
  });