angularjs-rails 1.0.6.2 → 1.0.7

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.6.2"
3
+ VERSION = "1.0.7"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.6
2
+ * @license AngularJS v1.0.7
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.6
2
+ * @license AngularJS v1.0.7
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -149,6 +149,14 @@ directive.tabbable = function() {
149
149
  };
150
150
  };
151
151
 
152
+ directive.table = function() {
153
+ return {
154
+ restrict: 'E',
155
+ link: function(scope, element, attrs) {
156
+ element[0].className = 'table table-bordered table-striped code-table';
157
+ }
158
+ };
159
+ };
152
160
 
153
161
  directive.tabPane = function() {
154
162
  return {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.6
2
+ * @license AngularJS v1.0.7
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -145,7 +145,8 @@ angular.module('ngCookies', ['ng']).
145
145
  * @returns {Object} Deserialized cookie value.
146
146
  */
147
147
  get: function(key) {
148
- return angular.fromJson($cookies[key]);
148
+ var value = $cookies[key];
149
+ return value ? angular.fromJson(value) : value;
149
150
  },
150
151
 
151
152
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.6
2
+ * @license AngularJS v1.0.7
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.6
2
+ * @license AngularJS v1.0.7
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  *
@@ -241,7 +241,7 @@ angular.mock.$ExceptionHandlerProvider = function() {
241
241
  *
242
242
  * @param {string} mode Mode of operation, defaults to `rethrow`.
243
243
  *
244
- * - `rethrow`: If any errors are are passed into the handler in tests, it typically
244
+ * - `rethrow`: If any errors are passed into the handler in tests, it typically
245
245
  * means that there is a bug in the application or test, so this mock will
246
246
  * make these tests fail.
247
247
  * - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log` mode stores an
@@ -322,7 +322,13 @@ angular.mock.$LogProvider = function() {
322
322
  * @propertyOf ngMock.$log
323
323
  *
324
324
  * @description
325
- * Array of logged messages.
325
+ * Array of messages logged using {@link ngMock.$log#log}.
326
+ *
327
+ * @example
328
+ * <pre>
329
+ * $log.log('Some Log');
330
+ * var first = $log.log.logs.unshift();
331
+ * </pre>
326
332
  */
327
333
  $log.log.logs = [];
328
334
  /**
@@ -331,7 +337,13 @@ angular.mock.$LogProvider = function() {
331
337
  * @propertyOf ngMock.$log
332
338
  *
333
339
  * @description
334
- * Array of logged messages.
340
+ * Array of messages logged using {@link ngMock.$log#warn}.
341
+ *
342
+ * @example
343
+ * <pre>
344
+ * $log.warn('Some Warning');
345
+ * var first = $log.warn.logs.unshift();
346
+ * </pre>
335
347
  */
336
348
  $log.warn.logs = [];
337
349
  /**
@@ -340,7 +352,13 @@ angular.mock.$LogProvider = function() {
340
352
  * @propertyOf ngMock.$log
341
353
  *
342
354
  * @description
343
- * Array of logged messages.
355
+ * Array of messages logged using {@link ngMock.$log#info}.
356
+ *
357
+ * @example
358
+ * <pre>
359
+ * $log.info('Some Info');
360
+ * var first = $log.info.logs.unshift();
361
+ * </pre>
344
362
  */
345
363
  $log.info.logs = [];
346
364
  /**
@@ -349,7 +367,13 @@ angular.mock.$LogProvider = function() {
349
367
  * @propertyOf ngMock.$log
350
368
  *
351
369
  * @description
352
- * Array of logged messages.
370
+ * Array of messages logged using {@link ngMock.$log#error}.
371
+ *
372
+ * @example
373
+ * <pre>
374
+ * $log.log('Some Error');
375
+ * var first = $log.error.logs.unshift();
376
+ * </pre>
353
377
  */
354
378
  $log.error.logs = [];
355
379
  };
@@ -653,10 +677,10 @@ angular.mock.dump = function(object) {
653
677
  * @ngdoc object
654
678
  * @name ngMock.$httpBackend
655
679
  * @description
656
- * Fake HTTP backend implementation suitable for unit testing application that use the
680
+ * Fake HTTP backend implementation suitable for unit testing applications that use the
657
681
  * {@link ng.$http $http service}.
658
682
  *
659
- * *Note*: For fake http backend implementation suitable for end-to-end testing or backend-less
683
+ * *Note*: For fake HTTP backend implementation suitable for end-to-end testing or backend-less
660
684
  * development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}.
661
685
  *
662
686
  * During unit testing, we want our unit tests to run quickly and have no external dependencies so
@@ -1687,12 +1711,8 @@ window.jasmine && (function(window) {
1687
1711
  * @name angular.mock.inject
1688
1712
  * @description
1689
1713
  *
1690
- <<<<<<< HEAD
1691
- * *NOTE*: This is function is also published on window for easy access.<br>
1692
- * *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}.
1693
- =======
1694
1714
  * *NOTE*: This function is also published on window for easy access.<br>
1695
- >>>>>>> 8dca056... docs(mocks): fix typos
1715
+ * *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}.
1696
1716
  *
1697
1717
  * The inject function wraps a function into an injectable function. The inject() creates new
1698
1718
  * instance of {@link AUTO.$injector $injector} per test, which is then used for
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.6
2
+ * @license AngularJS v1.0.7
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.6
2
+ * @license AngularJS v1.0.7
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -9405,7 +9405,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
9405
9405
  })( window );
9406
9406
 
9407
9407
  /**
9408
- * @license AngularJS v1.0.6
9408
+ * @license AngularJS v1.0.7
9409
9409
  * (c) 2010-2012 Google, Inc. http://angularjs.org
9410
9410
  * License: MIT
9411
9411
  */
@@ -9473,6 +9473,29 @@ var /** holds major version number for IE or NaN for real browsers */
9473
9473
  nodeName_,
9474
9474
  uid = ['0', '0', '0'];
9475
9475
 
9476
+
9477
+ /**
9478
+ * @private
9479
+ * @param {*} obj
9480
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
9481
+ */
9482
+ function isArrayLike(obj) {
9483
+ if (!obj || (typeof obj.length !== 'number')) return false;
9484
+
9485
+ // We have on object which has length property. Should we treat it as array?
9486
+ if (typeof obj.hasOwnProperty != 'function' &&
9487
+ typeof obj.constructor != 'function') {
9488
+ // This is here for IE8: it is a bogus object treat it as array;
9489
+ return true;
9490
+ } else {
9491
+ return obj instanceof JQLite || // JQLite
9492
+ (jQuery && obj instanceof jQuery) || // jQuery
9493
+ toString.call(obj) !== '[object Object]' || // some browser native object
9494
+ typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
9495
+ }
9496
+ }
9497
+
9498
+
9476
9499
  /**
9477
9500
  * @ngdoc function
9478
9501
  * @name angular.forEach
@@ -9500,30 +9523,6 @@ var /** holds major version number for IE or NaN for real browsers */
9500
9523
  * @param {Object=} context Object to become context (`this`) for the iterator function.
9501
9524
  * @returns {Object|Array} Reference to `obj`.
9502
9525
  */
9503
-
9504
-
9505
- /**
9506
- * @private
9507
- * @param {*} obj
9508
- * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
9509
- */
9510
- function isArrayLike(obj) {
9511
- if (!obj || (typeof obj.length !== 'number')) return false;
9512
-
9513
- // We have on object which has length property. Should we treat it as array?
9514
- if (typeof obj.hasOwnProperty != 'function' &&
9515
- typeof obj.constructor != 'function') {
9516
- // This is here for IE8: it is a bogus object treat it as array;
9517
- return true;
9518
- } else {
9519
- return obj instanceof JQLite || // JQLite
9520
- (jQuery && obj instanceof jQuery) || // jQuery
9521
- toString.call(obj) !== '[object Object]' || // some browser native object
9522
- typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
9523
- }
9524
- }
9525
-
9526
-
9527
9526
  function forEach(obj, iterator, context) {
9528
9527
  var key;
9529
9528
  if (obj) {
@@ -9607,6 +9606,21 @@ function nextUid() {
9607
9606
  return uid.join('');
9608
9607
  }
9609
9608
 
9609
+
9610
+ /**
9611
+ * Set or clear the hashkey for an object.
9612
+ * @param obj object
9613
+ * @param h the hashkey (!truthy to delete the hashkey)
9614
+ */
9615
+ function setHashKey(obj, h) {
9616
+ if (h) {
9617
+ obj.$$hashKey = h;
9618
+ }
9619
+ else {
9620
+ delete obj.$$hashKey;
9621
+ }
9622
+ }
9623
+
9610
9624
  /**
9611
9625
  * @ngdoc function
9612
9626
  * @name angular.extend
@@ -9618,8 +9632,10 @@ function nextUid() {
9618
9632
  *
9619
9633
  * @param {Object} dst Destination object.
9620
9634
  * @param {...Object} src Source object(s).
9635
+ * @returns {Object} Reference to `dst`.
9621
9636
  */
9622
9637
  function extend(dst) {
9638
+ var h = dst.$$hashKey;
9623
9639
  forEach(arguments, function(obj){
9624
9640
  if (obj !== dst) {
9625
9641
  forEach(obj, function(value, key){
@@ -9627,6 +9643,8 @@ function extend(dst) {
9627
9643
  });
9628
9644
  }
9629
9645
  });
9646
+
9647
+ setHashKey(dst,h);
9630
9648
  return dst;
9631
9649
  }
9632
9650
 
@@ -9981,12 +9999,14 @@ function copy(source, destination){
9981
9999
  destination.push(copy(source[i]));
9982
10000
  }
9983
10001
  } else {
10002
+ var h = destination.$$hashKey;
9984
10003
  forEach(destination, function(value, key){
9985
10004
  delete destination[key];
9986
10005
  });
9987
10006
  for ( var key in source) {
9988
10007
  destination[key] = copy(source[key]);
9989
10008
  }
10009
+ setHashKey(destination,h);
9990
10010
  }
9991
10011
  }
9992
10012
  return destination;
@@ -10026,7 +10046,7 @@ function shallowCopy(src, dst) {
10026
10046
  * During a property comparision, properties of `function` type and properties with names
10027
10047
  * that begin with `$` are ignored.
10028
10048
  *
10029
- * Scope and DOMWindow objects are being compared only be identify (`===`).
10049
+ * Scope and DOMWindow objects are being compared only by identify (`===`).
10030
10050
  *
10031
10051
  * @param {*} o1 Object or value to compare.
10032
10052
  * @param {*} o2 Object or value to compare.
@@ -10086,7 +10106,7 @@ function sliceArgs(args, startIndex) {
10086
10106
  *
10087
10107
  * @description
10088
10108
  * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
10089
- * `fn`). You can supply optional `args` that are are prebound to the function. This feature is also
10109
+ * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
10090
10110
  * known as [function currying](http://en.wikipedia.org/wiki/Currying).
10091
10111
  *
10092
10112
  * @param {Object} self Context which `fn` should be evaluated in.
@@ -10279,7 +10299,7 @@ function encodeUriQuery(val, pctEncodeSpaces) {
10279
10299
  *
10280
10300
  * @description
10281
10301
  *
10282
- * Use this directive to auto-bootstrap on application. Only
10302
+ * Use this directive to auto-bootstrap an application. Only
10283
10303
  * one directive can be used per HTML document. The directive
10284
10304
  * designates the root of the application and is typically placed
10285
10305
  * at the root of the page.
@@ -10418,7 +10438,7 @@ function bindJQuery() {
10418
10438
  }
10419
10439
 
10420
10440
  /**
10421
- * throw error of the argument is falsy.
10441
+ * throw error if the argument is falsy.
10422
10442
  */
10423
10443
  function assertArg(arg, name, reason) {
10424
10444
  if (!arg) {
@@ -10699,11 +10719,11 @@ function setupModuleLoader(window) {
10699
10719
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
10700
10720
  */
10701
10721
  var version = {
10702
- full: '1.0.6', // all of these placeholder strings will be replaced by grunt's
10722
+ full: '1.0.7', // all of these placeholder strings will be replaced by grunt's
10703
10723
  major: 1, // package task
10704
10724
  minor: 0,
10705
- dot: 6,
10706
- codeName: 'universal-irreversibility'
10725
+ dot: 7,
10726
+ codeName: 'monochromatic-rainbow'
10707
10727
  };
10708
10728
 
10709
10729
 
@@ -10848,18 +10868,18 @@ function publishExternalAPI(angular){
10848
10868
  * - [after()](http://api.jquery.com/after/)
10849
10869
  * - [append()](http://api.jquery.com/append/)
10850
10870
  * - [attr()](http://api.jquery.com/attr/)
10851
- * - [bind()](http://api.jquery.com/bind/)
10852
- * - [children()](http://api.jquery.com/children/)
10871
+ * - [bind()](http://api.jquery.com/bind/) - Does not support namespaces
10872
+ * - [children()](http://api.jquery.com/children/) - Does not support selectors
10853
10873
  * - [clone()](http://api.jquery.com/clone/)
10854
10874
  * - [contents()](http://api.jquery.com/contents/)
10855
10875
  * - [css()](http://api.jquery.com/css/)
10856
10876
  * - [data()](http://api.jquery.com/data/)
10857
10877
  * - [eq()](http://api.jquery.com/eq/)
10858
- * - [find()](http://api.jquery.com/find/) - Limited to lookups by tag name.
10878
+ * - [find()](http://api.jquery.com/find/) - Limited to lookups by tag name
10859
10879
  * - [hasClass()](http://api.jquery.com/hasClass/)
10860
10880
  * - [html()](http://api.jquery.com/html/)
10861
- * - [next()](http://api.jquery.com/next/)
10862
- * - [parent()](http://api.jquery.com/parent/)
10881
+ * - [next()](http://api.jquery.com/next/) - Does not support selectors
10882
+ * - [parent()](http://api.jquery.com/parent/) - Does not support selectors
10863
10883
  * - [prepend()](http://api.jquery.com/prepend/)
10864
10884
  * - [prop()](http://api.jquery.com/prop/)
10865
10885
  * - [ready()](http://api.jquery.com/ready/)
@@ -10871,7 +10891,7 @@ function publishExternalAPI(angular){
10871
10891
  * - [text()](http://api.jquery.com/text/)
10872
10892
  * - [toggleClass()](http://api.jquery.com/toggleClass/)
10873
10893
  * - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Doesn't pass native event objects to handlers.
10874
- * - [unbind()](http://api.jquery.com/unbind/)
10894
+ * - [unbind()](http://api.jquery.com/unbind/) - Does not support namespaces
10875
10895
  * - [val()](http://api.jquery.com/val/)
10876
10896
  * - [wrap()](http://api.jquery.com/wrap/)
10877
10897
  *
@@ -11418,23 +11438,43 @@ forEach({
11418
11438
 
11419
11439
  if (!eventFns) {
11420
11440
  if (type == 'mouseenter' || type == 'mouseleave') {
11421
- var counter = 0;
11441
+ var contains = document.body.contains || document.body.compareDocumentPosition ?
11442
+ function( a, b ) {
11443
+ var adown = a.nodeType === 9 ? a.documentElement : a,
11444
+ bup = b && b.parentNode;
11445
+ return a === bup || !!( bup && bup.nodeType === 1 && (
11446
+ adown.contains ?
11447
+ adown.contains( bup ) :
11448
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
11449
+ ));
11450
+ } :
11451
+ function( a, b ) {
11452
+ if ( b ) {
11453
+ while ( (b = b.parentNode) ) {
11454
+ if ( b === a ) {
11455
+ return true;
11456
+ }
11457
+ }
11458
+ }
11459
+ return false;
11460
+ };
11422
11461
 
11423
- events.mouseenter = [];
11424
- events.mouseleave = [];
11462
+ events[type] = [];
11463
+
11464
+ // Refer to jQuery's implementation of mouseenter & mouseleave
11465
+ // Read about mouseenter and mouseleave:
11466
+ // http://www.quirksmode.org/js/events_mouse.html#link8
11467
+ var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"}
11468
+ bindFn(element, eventmap[type], function(event) {
11469
+ var ret, target = this, related = event.relatedTarget;
11470
+ // For mousenter/leave call the handler if related is outside the target.
11471
+ // NB: No relatedTarget if the mouse left/entered the browser window
11472
+ if ( !related || (related !== target && !contains(target, related)) ){
11473
+ handle(event, type);
11474
+ }
11425
11475
 
11426
- bindFn(element, 'mouseover', function(event) {
11427
- counter++;
11428
- if (counter == 1) {
11429
- handle(event, 'mouseenter');
11430
- }
11431
- });
11432
- bindFn(element, 'mouseout', function(event) {
11433
- counter --;
11434
- if (counter == 0) {
11435
- handle(event, 'mouseleave');
11436
- }
11437
11476
  });
11477
+
11438
11478
  } else {
11439
11479
  addEventListenerFn(element, type, handle);
11440
11480
  events[type] = [];
@@ -11750,7 +11790,7 @@ function annotate(fn) {
11750
11790
  }
11751
11791
  } else if (isArray(fn)) {
11752
11792
  last = fn.length - 1;
11753
- assertArgFn(fn[last], 'fn')
11793
+ assertArgFn(fn[last], 'fn');
11754
11794
  $inject = fn.slice(0, last);
11755
11795
  } else {
11756
11796
  assertArgFn(fn, 'fn', true);
@@ -11784,7 +11824,7 @@ function annotate(fn) {
11784
11824
  * # Injection Function Annotation
11785
11825
  *
11786
11826
  * JavaScript does not have annotations, and annotations are needed for dependency injection. The
11787
- * following ways are all valid way of annotating function with injection arguments and are equivalent.
11827
+ * following are all valid ways of annotating function with injection arguments and are equivalent.
11788
11828
  *
11789
11829
  * <pre>
11790
11830
  * // inferred (only works if code not minified/obfuscated)
@@ -11913,7 +11953,7 @@ function annotate(fn) {
11913
11953
  * // ...
11914
11954
  * };
11915
11955
  * tmpFn.$inject = ['$compile', '$rootScope'];
11916
- * injector.invoke(tempFn);
11956
+ * injector.invoke(tmpFn);
11917
11957
  *
11918
11958
  * // To better support inline function the inline annotation is supported
11919
11959
  * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
@@ -11966,7 +12006,7 @@ function annotate(fn) {
11966
12006
  *
11967
12007
  * beforeEach(module(function($provide) {
11968
12008
  * $provide.provider('greet', GreetProvider);
11969
- * });
12009
+ * }));
11970
12010
  *
11971
12011
  * it('should greet', inject(function(greet) {
11972
12012
  * expect(greet('angular')).toEqual('Hello angular!');
@@ -11979,9 +12019,7 @@ function annotate(fn) {
11979
12019
  * inject(function(greet) {
11980
12020
  * expect(greet('angular')).toEqual('Ahoj angular!');
11981
12021
  * });
11982
- * )};
11983
- *
11984
- * });
12022
+ * });
11985
12023
  * </pre>
11986
12024
  */
11987
12025
 
@@ -12075,7 +12113,7 @@ function annotate(fn) {
12075
12113
  *
12076
12114
  * @param {string} name The name of the service to decorate.
12077
12115
  * @param {function()} decorator This function will be invoked when the service needs to be
12078
- * instanciated. The function is called using the {@link AUTO.$injector#invoke
12116
+ * instantiated. The function is called using the {@link AUTO.$injector#invoke
12079
12117
  * injector.invoke} method and is therefore fully injectable. Local injection arguments:
12080
12118
  *
12081
12119
  * * `$delegate` - The original service instance, which can be monkey patched, configured,
@@ -12275,6 +12313,8 @@ function createInjector(modulesToLoad) {
12275
12313
  var Constructor = function() {},
12276
12314
  instance, returnedValue;
12277
12315
 
12316
+ // Check if Type is annotated and use just the given function at n-1 as parameter
12317
+ // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
12278
12318
  Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
12279
12319
  instance = new Constructor();
12280
12320
  returnedValue = invoke(Type, instance, locals);
@@ -12655,7 +12695,13 @@ function Browser(window, document, $log, $sniffer) {
12655
12695
  cookie = cookieArray[i];
12656
12696
  index = cookie.indexOf('=');
12657
12697
  if (index > 0) { //ignore nameless cookies
12658
- lastCookies[unescape(cookie.substring(0, index))] = unescape(cookie.substring(index + 1));
12698
+ var name = unescape(cookie.substring(0, index));
12699
+ // the first value that is seen for a cookie is the most
12700
+ // specific one. values for the same cookie name that
12701
+ // follow are for less specific paths.
12702
+ if (lastCookies[name] === undefined) {
12703
+ lastCookies[name] = unescape(cookie.substring(index + 1));
12704
+ }
12659
12705
  }
12660
12706
  }
12661
12707
  }
@@ -13460,9 +13506,9 @@ function $CompileProvider($provide) {
13460
13506
 
13461
13507
 
13462
13508
  /**
13463
- * Once the directives have been collected their compile functions is executed. This method
13509
+ * Once the directives have been collected, their compile functions are executed. This method
13464
13510
  * is responsible for inlining directive templates as well as terminating the application
13465
- * of the directives if the terminal directive has been reached..
13511
+ * of the directives if the terminal directive has been reached.
13466
13512
  *
13467
13513
  * @param {Array} directives Array of collected directives to execute their compile function.
13468
13514
  * this needs to be pre-sorted by priority order.
@@ -13470,11 +13516,11 @@ function $CompileProvider($provide) {
13470
13516
  * @param {Object} templateAttrs The shared attribute function
13471
13517
  * @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the
13472
13518
  * scope argument is auto-generated to the new child of the transcluded parent scope.
13473
- * @param {DOMElement} $rootElement If we are working on the root of the compile tree then this
13474
- * argument has the root jqLite array so that we can replace widgets on it.
13519
+ * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
13520
+ * argument has the root jqLite array so that we can replace nodes on it.
13475
13521
  * @returns linkFn
13476
13522
  */
13477
- function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, $rootElement) {
13523
+ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, jqCollection) {
13478
13524
  var terminalPriority = -Number.MAX_VALUE,
13479
13525
  preLinkFns = [],
13480
13526
  postLinkFns = [],
@@ -13528,7 +13574,7 @@ function $CompileProvider($provide) {
13528
13574
  $compileNode = templateAttrs.$$element =
13529
13575
  jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' '));
13530
13576
  compileNode = $compileNode[0];
13531
- replaceWith($rootElement, jqLite($template[0]), compileNode);
13577
+ replaceWith(jqCollection, jqLite($template[0]), compileNode);
13532
13578
  childTranscludeFn = compile($template, transcludeFn, terminalPriority);
13533
13579
  } else {
13534
13580
  $template = jqLite(JQLiteClone(compileNode)).contents();
@@ -13552,7 +13598,7 @@ function $CompileProvider($provide) {
13552
13598
  throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue);
13553
13599
  }
13554
13600
 
13555
- replaceWith($rootElement, $compileNode, compileNode);
13601
+ replaceWith(jqCollection, $compileNode, compileNode);
13556
13602
 
13557
13603
  var newTemplateAttrs = {$attr: {}};
13558
13604
 
@@ -13580,7 +13626,7 @@ function $CompileProvider($provide) {
13580
13626
  assertNoDuplicate('template', templateDirective, directive, $compileNode);
13581
13627
  templateDirective = directive;
13582
13628
  nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i),
13583
- nodeLinkFn, $compileNode, templateAttrs, $rootElement, directive.replace,
13629
+ nodeLinkFn, $compileNode, templateAttrs, jqCollection, directive.replace,
13584
13630
  childTranscludeFn);
13585
13631
  ii = directives.length;
13586
13632
  } else if (directive.compile) {
@@ -13713,7 +13759,7 @@ function $CompileProvider($provide) {
13713
13759
  parentGet = $parse(attrs[attrName]);
13714
13760
  scope[scopeName] = function(locals) {
13715
13761
  return parentGet(parentScope, locals);
13716
- }
13762
+ };
13717
13763
  break;
13718
13764
  }
13719
13765
 
@@ -14201,7 +14247,7 @@ function $DocumentProvider(){
14201
14247
  *
14202
14248
  */
14203
14249
  function $ExceptionHandlerProvider() {
14204
- this.$get = ['$log', function($log){
14250
+ this.$get = ['$log', function($log) {
14205
14251
  return function(exception, cause) {
14206
14252
  $log.error.apply($log, arguments);
14207
14253
  };
@@ -14966,6 +15012,10 @@ function $LocationProvider(){
14966
15012
  // update $location when $browser url changes
14967
15013
  $browser.onUrlChange(function(newUrl) {
14968
15014
  if ($location.absUrl() != newUrl) {
15015
+ if ($rootScope.$broadcast('$locationChangeStart', newUrl, $location.absUrl()).defaultPrevented) {
15016
+ $browser.url($location.absUrl());
15017
+ return;
15018
+ }
14969
15019
  $rootScope.$evalAsync(function() {
14970
15020
  var oldUrl = $location.absUrl();
14971
15021
 
@@ -15274,10 +15324,10 @@ function lex(text, csp){
15274
15324
  function readIdent() {
15275
15325
  var ident = "",
15276
15326
  start = index,
15277
- lastDot, peekIndex, methodName;
15327
+ lastDot, peekIndex, methodName, ch;
15278
15328
 
15279
15329
  while (index < text.length) {
15280
- var ch = text.charAt(index);
15330
+ ch = text.charAt(index);
15281
15331
  if (ch == '.' || isIdent(ch) || isNumber(ch)) {
15282
15332
  if (ch == '.') lastDot = index;
15283
15333
  ident += ch;
@@ -15291,7 +15341,7 @@ function lex(text, csp){
15291
15341
  if (lastDot) {
15292
15342
  peekIndex = index;
15293
15343
  while(peekIndex < text.length) {
15294
- var ch = text.charAt(peekIndex);
15344
+ ch = text.charAt(peekIndex);
15295
15345
  if (ch == '(') {
15296
15346
  methodName = ident.substr(lastDot - start + 1);
15297
15347
  ident = ident.substr(0, lastDot - start);
@@ -15544,8 +15594,8 @@ function parser(text, json, $filter, csp){
15544
15594
  text.substring(0, token.index) + "] can not be assigned to", token);
15545
15595
  }
15546
15596
  right = logicalOR();
15547
- return function(self, locals){
15548
- return left.assign(self, right(self, locals), locals);
15597
+ return function(scope, locals){
15598
+ return left.assign(scope, right(scope, locals), locals);
15549
15599
  };
15550
15600
  } else {
15551
15601
  return left;
@@ -15662,12 +15712,12 @@ function parser(text, json, $filter, csp){
15662
15712
  var field = expect().text;
15663
15713
  var getter = getterFn(field, csp);
15664
15714
  return extend(
15665
- function(self, locals) {
15666
- return getter(object(self, locals), locals);
15715
+ function(scope, locals, self) {
15716
+ return getter(self || object(scope, locals), locals);
15667
15717
  },
15668
15718
  {
15669
- assign:function(self, value, locals) {
15670
- return setter(object(self, locals), field, value);
15719
+ assign:function(scope, value, locals) {
15720
+ return setter(object(scope, locals), field, value);
15671
15721
  }
15672
15722
  }
15673
15723
  );
@@ -15708,14 +15758,14 @@ function parser(text, json, $filter, csp){
15708
15758
  } while (expect(','));
15709
15759
  }
15710
15760
  consume(')');
15711
- return function(self, locals){
15761
+ return function(scope, locals){
15712
15762
  var args = [],
15713
- context = contextGetter ? contextGetter(self, locals) : self;
15763
+ context = contextGetter ? contextGetter(scope, locals) : scope;
15714
15764
 
15715
15765
  for ( var i = 0; i < argsFn.length; i++) {
15716
- args.push(argsFn[i](self, locals));
15766
+ args.push(argsFn[i](scope, locals));
15717
15767
  }
15718
- var fnPtr = fn(self, locals) || noop;
15768
+ var fnPtr = fn(scope, locals, context) || noop;
15719
15769
  // IE stupidity!
15720
15770
  return fnPtr.apply
15721
15771
  ? fnPtr.apply(context, args)
@@ -15757,8 +15807,7 @@ function parser(text, json, $filter, csp){
15757
15807
  var object = {};
15758
15808
  for ( var i = 0; i < keyValues.length; i++) {
15759
15809
  var keyValue = keyValues[i];
15760
- var value = keyValue.value(self, locals);
15761
- object[keyValue.key] = value;
15810
+ object[keyValue.key] = keyValue.value(self, locals);
15762
15811
  }
15763
15812
  return object;
15764
15813
  };
@@ -15880,7 +15929,7 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4) {
15880
15929
  }
15881
15930
  return pathVal;
15882
15931
  };
15883
- };
15932
+ }
15884
15933
 
15885
15934
  function getterFn(path, csp) {
15886
15935
  if (getterFnCache.hasOwnProperty(path)) {
@@ -15895,7 +15944,7 @@ function getterFn(path, csp) {
15895
15944
  fn = (pathKeysLength < 6)
15896
15945
  ? cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4])
15897
15946
  : function(scope, locals) {
15898
- var i = 0, val
15947
+ var i = 0, val;
15899
15948
  do {
15900
15949
  val = cspSafeGetterFn(
15901
15950
  pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++]
@@ -16108,7 +16157,7 @@ function $ParseProvider() {
16108
16157
  * models and avoiding unnecessary browser repaints, which would result in flickering UI.
16109
16158
  * - $q promises are recognized by the templating engine in angular, which means that in templates
16110
16159
  * you can treat promises attached to a scope as if they were the resulting values.
16111
- * - Q has many more features that $q, but that comes at a cost of bytes. $q is tiny, but contains
16160
+ * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
16112
16161
  * all the important functionality needed for common async tasks.
16113
16162
  *
16114
16163
  * # Testing
@@ -16303,10 +16352,7 @@ function qFactory(nextTick, exceptionHandler) {
16303
16352
  * the promise comes from a source that can't be trusted.
16304
16353
  *
16305
16354
  * @param {*} value Value or a promise
16306
- * @returns {Promise} Returns a single promise that will be resolved with an array of values,
16307
- * each value corresponding to the promise at the same index in the `promises` array. If any of
16308
- * the promises is resolved with a rejection, this resulting promise will be resolved with the
16309
- * same rejection.
16355
+ * @returns {Promise} Returns a promise of the passed value or promise
16310
16356
  */
16311
16357
  var when = function(value, callback, errback) {
16312
16358
  var result = defer(),
@@ -16902,22 +16948,22 @@ function $RouteParamsProvider() {
16902
16948
  /**
16903
16949
  * DESIGN NOTES
16904
16950
  *
16905
- * The design decisions behind the scope ware heavily favored for speed and memory consumption.
16951
+ * The design decisions behind the scope are heavily favored for speed and memory consumption.
16906
16952
  *
16907
16953
  * The typical use of scope is to watch the expressions, which most of the time return the same
16908
16954
  * value as last time so we optimize the operation.
16909
16955
  *
16910
- * Closures construction is expensive from speed as well as memory:
16911
- * - no closures, instead ups prototypical inheritance for API
16956
+ * Closures construction is expensive in terms of speed as well as memory:
16957
+ * - No closures, instead use prototypical inheritance for API
16912
16958
  * - Internal state needs to be stored on scope directly, which means that private state is
16913
16959
  * exposed as $$____ properties
16914
16960
  *
16915
16961
  * Loop operations are optimized by using while(count--) { ... }
16916
16962
  * - this means that in order to keep the same order of execution as addition we have to add
16917
- * items to the array at the begging (shift) instead of at the end (push)
16963
+ * items to the array at the beginning (shift) instead of at the end (push)
16918
16964
  *
16919
16965
  * Child scopes are created and removed often
16920
- * - Using array would be slow since inserts in meddle are expensive so we use linked list
16966
+ * - Using an array would be slow since inserts in middle are expensive so we use linked list
16921
16967
  *
16922
16968
  * There are few watches then a lot of observers. This is why you don't want the observer to be
16923
16969
  * implemented in the same way as watch. Watch requires return of initialization function which
@@ -16939,7 +16985,7 @@ function $RouteParamsProvider() {
16939
16985
  * @methodOf ng.$rootScopeProvider
16940
16986
  * @description
16941
16987
  *
16942
- * Sets the number of digest iteration the scope should attempt to execute before giving up and
16988
+ * Sets the number of digest iterations the scope should attempt to execute before giving up and
16943
16989
  * assuming that the model is unstable.
16944
16990
  *
16945
16991
  * The current default is 10 iterations.
@@ -17219,7 +17265,7 @@ function $RootScopeProvider(){
17219
17265
  * @function
17220
17266
  *
17221
17267
  * @description
17222
- * Process all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and its children.
17268
+ * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and its children.
17223
17269
  * Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change the model, the
17224
17270
  * `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} until no more listeners are
17225
17271
  * firing. This means that it is possible to get into an infinite loop. This function will throw
@@ -17561,7 +17607,7 @@ function $RootScopeProvider(){
17561
17607
  * Afterwards, the event traverses upwards toward the root scope and calls all registered
17562
17608
  * listeners along the way. The event will stop propagating if one of the listeners cancels it.
17563
17609
  *
17564
- * Any exception emmited from the {@link ng.$rootScope.Scope#$on listeners} will be passed
17610
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
17565
17611
  * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
17566
17612
  *
17567
17613
  * @param {string} name Event name to emit.
@@ -17630,7 +17676,7 @@ function $RootScopeProvider(){
17630
17676
  * Any exception emmited from the {@link ng.$rootScope.Scope#$on listeners} will be passed
17631
17677
  * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
17632
17678
  *
17633
- * @param {string} name Event name to emit.
17679
+ * @param {string} name Event name to broadcast.
17634
17680
  * @param {...*} args Optional set of arguments which will be passed onto the event listeners.
17635
17681
  * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
17636
17682
  */
@@ -17776,10 +17822,23 @@ function $SnifferProvider() {
17776
17822
  * @example
17777
17823
  <doc:example>
17778
17824
  <doc:source>
17779
- <input ng-init="$window = $service('$window'); greeting='Hello World!'" type="text" ng-model="greeting" />
17780
- <button ng-click="$window.alert(greeting)">ALERT</button>
17825
+ <script>
17826
+ function Ctrl($scope, $window) {
17827
+ $scope.$window = $window;
17828
+ $scope.greeting = 'Hello, World!';
17829
+ }
17830
+ </script>
17831
+ <div ng-controller="Ctrl">
17832
+ <input type="text" ng-model="greeting" />
17833
+ <button ng-click="$window.alert(greeting)">ALERT</button>
17834
+ </div>
17781
17835
  </doc:source>
17782
17836
  <doc:scenario>
17837
+ it('should display the greeting in the input box', function() {
17838
+ input('greeting').enter('Hello, E2E Tests');
17839
+ // If we click the button it will block the test runner
17840
+ // element(':button').click();
17841
+ });
17783
17842
  </doc:scenario>
17784
17843
  </doc:example>
17785
17844
  */
@@ -17932,7 +17991,7 @@ function $HttpProvider() {
17932
17991
  *
17933
17992
  * @description
17934
17993
  * The `$http` service is a core Angular service that facilitates communication with the remote
17935
- * HTTP servers via browser's {@link https://developer.mozilla.org/en/xmlhttprequest
17994
+ * HTTP servers via the browser's {@link https://developer.mozilla.org/en/xmlhttprequest
17936
17995
  * XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}.
17937
17996
  *
17938
17997
  * For unit testing applications that use `$http` service, see
@@ -17942,13 +18001,13 @@ function $HttpProvider() {
17942
18001
  * $resource} service.
17943
18002
  *
17944
18003
  * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
17945
- * the $q service. While for simple usage patters this doesn't matter much, for advanced usage,
17946
- * it is important to familiarize yourself with these apis and guarantees they provide.
18004
+ * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
18005
+ * it is important to familiarize yourself with these APIs and the guarantees they provide.
17947
18006
  *
17948
18007
  *
17949
18008
  * # General usage
17950
18009
  * The `$http` service is a function which takes a single argument — a configuration object —
17951
- * that is used to generate an http request and returns a {@link ng.$q promise}
18010
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise}
17952
18011
  * with two $http specific methods: `success` and `error`.
17953
18012
  *
17954
18013
  * <pre>
@@ -17963,21 +18022,21 @@ function $HttpProvider() {
17963
18022
  * });
17964
18023
  * </pre>
17965
18024
  *
17966
- * Since the returned value of calling the $http function is a Promise object, you can also use
18025
+ * Since the returned value of calling the $http function is a `promise`, you can also use
17967
18026
  * the `then` method to register callbacks, and these callbacks will receive a single argument –
17968
- * an object representing the response. See the api signature and type info below for more
18027
+ * an object representing the response. See the API signature and type info below for more
17969
18028
  * details.
17970
18029
  *
17971
- * A response status code that falls in the [200, 300) range is considered a success status and
18030
+ * A response status code between 200 and 299 is considered a success status and
17972
18031
  * will result in the success callback being called. Note that if the response is a redirect,
17973
18032
  * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
17974
18033
  * called for such responses.
17975
18034
  *
17976
18035
  * # Shortcut methods
17977
18036
  *
17978
- * Since all invocation of the $http service require definition of the http method and url and
17979
- * POST and PUT requests require response body/data to be provided as well, shortcut methods
17980
- * were created to simplify using the api:
18037
+ * Since all invocations of the $http service require passing in an HTTP method and URL, and
18038
+ * POST/PUT requests require request data to be provided as well, shortcut methods
18039
+ * were created:
17981
18040
  *
17982
18041
  * <pre>
17983
18042
  * $http.get('/someUrl').success(successCallback);
@@ -17996,25 +18055,25 @@ function $HttpProvider() {
17996
18055
  *
17997
18056
  * # Setting HTTP Headers
17998
18057
  *
17999
- * The $http service will automatically add certain http headers to all requests. These defaults
18058
+ * The $http service will automatically add certain HTTP headers to all requests. These defaults
18000
18059
  * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
18001
18060
  * object, which currently contains this default configuration:
18002
18061
  *
18003
18062
  * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
18004
18063
  * - `Accept: application/json, text/plain, * / *`
18005
18064
  * - `X-Requested-With: XMLHttpRequest`
18006
- * - `$httpProvider.defaults.headers.post`: (header defaults for HTTP POST requests)
18065
+ * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
18007
18066
  * - `Content-Type: application/json`
18008
- * - `$httpProvider.defaults.headers.put` (header defaults for HTTP PUT requests)
18067
+ * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
18009
18068
  * - `Content-Type: application/json`
18010
18069
  *
18011
- * To add or overwrite these defaults, simply add or remove a property from this configuration
18070
+ * To add or overwrite these defaults, simply add or remove a property from these configuration
18012
18071
  * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
18013
- * with name equal to the lower-cased http method name, e.g.
18072
+ * with the lowercased HTTP method name as the key, e.g.
18014
18073
  * `$httpProvider.defaults.headers.get['My-Header']='value'`.
18015
18074
  *
18016
- * Additionally, the defaults can be set at runtime via the `$http.defaults` object in a similar
18017
- * fassion as described above.
18075
+ * Additionally, the defaults can be set at runtime via the `$http.defaults` object in the same
18076
+ * fashion.
18018
18077
  *
18019
18078
  *
18020
18079
  * # Transforming Requests and Responses
@@ -18024,36 +18083,36 @@ function $HttpProvider() {
18024
18083
  *
18025
18084
  * Request transformations:
18026
18085
  *
18027
- * - if the `data` property of the request config object contains an object, serialize it into
18086
+ * - If the `data` property of the request configuration object contains an object, serialize it into
18028
18087
  * JSON format.
18029
18088
  *
18030
18089
  * Response transformations:
18031
18090
  *
18032
- * - if XSRF prefix is detected, strip it (see Security Considerations section below)
18033
- * - if json response is detected, deserialize it using a JSON parser
18091
+ * - If XSRF prefix is detected, strip it (see Security Considerations section below).
18092
+ * - If JSON response is detected, deserialize it using a JSON parser.
18034
18093
  *
18035
18094
  * To globally augment or override the default transforms, modify the `$httpProvider.defaults.transformRequest` and
18036
- * `$httpProvider.defaults.transformResponse` properties of the `$httpProvider`. These properties are by default an
18095
+ * `$httpProvider.defaults.transformResponse` properties. These properties are by default an
18037
18096
  * array of transform functions, which allows you to `push` or `unshift` a new transformation function into the
18038
18097
  * transformation chain. You can also decide to completely override any default transformations by assigning your
18039
18098
  * transformation functions to these properties directly without the array wrapper.
18040
18099
  *
18041
18100
  * Similarly, to locally override the request/response transforms, augment the `transformRequest` and/or
18042
- * `transformResponse` properties of the config object passed into `$http`.
18101
+ * `transformResponse` properties of the configuration object passed into `$http`.
18043
18102
  *
18044
18103
  *
18045
18104
  * # Caching
18046
18105
  *
18047
- * To enable caching set the configuration property `cache` to `true`. When the cache is
18106
+ * To enable caching, set the configuration property `cache` to `true`. When the cache is
18048
18107
  * enabled, `$http` stores the response from the server in local cache. Next time the
18049
18108
  * response is served from the cache without sending a request to the server.
18050
18109
  *
18051
18110
  * Note that even if the response is served from cache, delivery of the data is asynchronous in
18052
18111
  * the same way that real requests are.
18053
18112
  *
18054
- * If there are multiple GET requests for the same url that should be cached using the same
18113
+ * If there are multiple GET requests for the same URL that should be cached using the same
18055
18114
  * cache, but the cache is not populated yet, only one request to the server will be made and
18056
- * the remaining requests will be fulfilled using the response for the first request.
18115
+ * the remaining requests will be fulfilled using the response from the first request.
18057
18116
  *
18058
18117
  *
18059
18118
  * # Response interceptors
@@ -18105,7 +18164,7 @@ function $HttpProvider() {
18105
18164
  * When designing web applications, consider security threats from:
18106
18165
  *
18107
18166
  * - {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
18108
- * JSON Vulnerability}
18167
+ * JSON vulnerability}
18109
18168
  * - {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF}
18110
18169
  *
18111
18170
  * Both server and the client must cooperate in order to eliminate these threats. Angular comes
@@ -18115,8 +18174,8 @@ function $HttpProvider() {
18115
18174
  * ## JSON Vulnerability Protection
18116
18175
  *
18117
18176
  * A {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
18118
- * JSON Vulnerability} allows third party web-site to turn your JSON resource URL into
18119
- * {@link http://en.wikipedia.org/wiki/JSON#JSONP JSONP} request under some conditions. To
18177
+ * JSON vulnerability} allows third party website to turn your JSON resource URL into
18178
+ * {@link http://en.wikipedia.org/wiki/JSONP JSONP} request under some conditions. To
18120
18179
  * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
18121
18180
  * Angular will automatically strip the prefix before processing it as JSON.
18122
18181
  *
@@ -18137,19 +18196,19 @@ function $HttpProvider() {
18137
18196
  * ## Cross Site Request Forgery (XSRF) Protection
18138
18197
  *
18139
18198
  * {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} is a technique by which
18140
- * an unauthorized site can gain your user's private data. Angular provides following mechanism
18199
+ * an unauthorized site can gain your user's private data. Angular provides a mechanism
18141
18200
  * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
18142
18201
  * called `XSRF-TOKEN` and sets it as the HTTP header `X-XSRF-TOKEN`. Since only JavaScript that
18143
18202
  * runs on your domain could read the cookie, your server can be assured that the XHR came from
18144
18203
  * JavaScript running on your domain.
18145
18204
  *
18146
18205
  * To take advantage of this, your server needs to set a token in a JavaScript readable session
18147
- * cookie called `XSRF-TOKEN` on first HTTP GET request. On subsequent non-GET requests the
18206
+ * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
18148
18207
  * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
18149
- * that only JavaScript running on your domain could have read the token. The token must be
18150
- * unique for each user and must be verifiable by the server (to prevent the JavaScript making
18208
+ * that only JavaScript running on your domain could have sent the request. The token must be
18209
+ * unique for each user and must be verifiable by the server (to prevent the JavaScript from making
18151
18210
  * up its own tokens). We recommend that the token is a digest of your site's authentication
18152
- * cookie with {@link http://en.wikipedia.org/wiki/Rainbow_table salt for added security}.
18211
+ * cookie with a {@link https://en.wikipedia.org/wiki/Salt_(cryptography) salt} for added security.
18153
18212
  *
18154
18213
  *
18155
18214
  * @param {object} config Object describing the request to be made and how it should be
@@ -18327,7 +18386,7 @@ function $HttpProvider() {
18327
18386
  * @methodOf ng.$http
18328
18387
  *
18329
18388
  * @description
18330
- * Shortcut method to perform `GET` request
18389
+ * Shortcut method to perform `GET` request.
18331
18390
  *
18332
18391
  * @param {string} url Relative or absolute URL specifying the destination of the request
18333
18392
  * @param {Object=} config Optional configuration object
@@ -18340,7 +18399,7 @@ function $HttpProvider() {
18340
18399
  * @methodOf ng.$http
18341
18400
  *
18342
18401
  * @description
18343
- * Shortcut method to perform `DELETE` request
18402
+ * Shortcut method to perform `DELETE` request.
18344
18403
  *
18345
18404
  * @param {string} url Relative or absolute URL specifying the destination of the request
18346
18405
  * @param {Object=} config Optional configuration object
@@ -18353,7 +18412,7 @@ function $HttpProvider() {
18353
18412
  * @methodOf ng.$http
18354
18413
  *
18355
18414
  * @description
18356
- * Shortcut method to perform `HEAD` request
18415
+ * Shortcut method to perform `HEAD` request.
18357
18416
  *
18358
18417
  * @param {string} url Relative or absolute URL specifying the destination of the request
18359
18418
  * @param {Object=} config Optional configuration object
@@ -18366,7 +18425,7 @@ function $HttpProvider() {
18366
18425
  * @methodOf ng.$http
18367
18426
  *
18368
18427
  * @description
18369
- * Shortcut method to perform `JSONP` request
18428
+ * Shortcut method to perform `JSONP` request.
18370
18429
  *
18371
18430
  * @param {string} url Relative or absolute URL specifying the destination of the request.
18372
18431
  * Should contain `JSON_CALLBACK` string.
@@ -18381,7 +18440,7 @@ function $HttpProvider() {
18381
18440
  * @methodOf ng.$http
18382
18441
  *
18383
18442
  * @description
18384
- * Shortcut method to perform `POST` request
18443
+ * Shortcut method to perform `POST` request.
18385
18444
  *
18386
18445
  * @param {string} url Relative or absolute URL specifying the destination of the request
18387
18446
  * @param {*} data Request content
@@ -18395,7 +18454,7 @@ function $HttpProvider() {
18395
18454
  * @methodOf ng.$http
18396
18455
  *
18397
18456
  * @description
18398
- * Shortcut method to perform `PUT` request
18457
+ * Shortcut method to perform `PUT` request.
18399
18458
  *
18400
18459
  * @param {string} url Relative or absolute URL specifying the destination of the request
18401
18460
  * @param {*} data Request content
@@ -18447,7 +18506,7 @@ function $HttpProvider() {
18447
18506
 
18448
18507
 
18449
18508
  /**
18450
- * Makes the request
18509
+ * Makes the request.
18451
18510
  *
18452
18511
  * !!! ACCESSES CLOSURE VARS:
18453
18512
  * $httpBackend, $config, $log, $rootScope, defaultCache, $http.pendingRequests
@@ -18794,17 +18853,17 @@ function $TimeoutProvider() {
18794
18853
  * block and delegates any exceptions to
18795
18854
  * {@link ng.$exceptionHandler $exceptionHandler} service.
18796
18855
  *
18797
- * The return value of registering a timeout function is a promise which will be resolved when
18856
+ * The return value of registering a timeout function is a promise, which will be resolved when
18798
18857
  * the timeout is reached and the timeout function is executed.
18799
18858
  *
18800
- * To cancel a the timeout request, call `$timeout.cancel(promise)`.
18859
+ * To cancel a timeout request, call `$timeout.cancel(promise)`.
18801
18860
  *
18802
18861
  * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
18803
18862
  * synchronously flush the queue of deferred functions.
18804
18863
  *
18805
- * @param {function()} fn A function, who's execution should be delayed.
18864
+ * @param {function()} fn A function, whose execution should be delayed.
18806
18865
  * @param {number=} [delay=0] Delay in milliseconds.
18807
- * @param {boolean=} [invokeApply=true] If set to false skips model dirty checking, otherwise
18866
+ * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
18808
18867
  * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
18809
18868
  * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
18810
18869
  * promise will be resolved with is the return value of the `fn` function.
@@ -18844,7 +18903,7 @@ function $TimeoutProvider() {
18844
18903
  * @methodOf ng.$timeout
18845
18904
  *
18846
18905
  * @description
18847
- * Cancels a task associated with the `promise`. As a result of this the promise will be
18906
+ * Cancels a task associated with the `promise`. As a result of this, the promise will be
18848
18907
  * resolved with a rejection.
18849
18908
  *
18850
18909
  * @param {Promise=} promise Promise returned by the `$timeout` function.
@@ -18932,7 +18991,7 @@ function $TimeoutProvider() {
18932
18991
  *
18933
18992
  * The general syntax in templates is as follows:
18934
18993
  *
18935
- * {{ expression | [ filter_name ] }}
18994
+ * {{ expression [| filter_name[:parameter_value] ... ] }}
18936
18995
  *
18937
18996
  * @param {String} name Name of the filter function to retrieve
18938
18997
  * @return {Function} the filter function
@@ -19017,7 +19076,7 @@ function $FilterProvider($provide) {
19017
19076
  <hr>
19018
19077
  Any: <input ng-model="search.$"> <br>
19019
19078
  Name only <input ng-model="search.name"><br>
19020
- Phone only <input ng-model="search.phone"å><br>
19079
+ Phone only <input ng-model="search.phone"><br>
19021
19080
  <table id="searchObjResults">
19022
19081
  <tr><th>Name</th><th>Phone</th></tr>
19023
19082
  <tr ng-repeat="friend in friends | filter:search">
@@ -19320,6 +19379,7 @@ function padNumber(num, digits, trim) {
19320
19379
 
19321
19380
 
19322
19381
  function dateGetter(name, size, offset, trim) {
19382
+ offset = offset || 0;
19323
19383
  return function(date) {
19324
19384
  var value = date['get' + name]();
19325
19385
  if (offset > 0 || value > -offset)
@@ -19430,7 +19490,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
19430
19490
  * (e.g. `"h o''clock"`).
19431
19491
  *
19432
19492
  * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
19433
- * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and it's
19493
+ * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and its
19434
19494
  * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
19435
19495
  * specified in the string input, the time is considered to be in the local timezone.
19436
19496
  * @param {string=} format Formatting rules (see Description). If not specified,
@@ -20548,8 +20608,8 @@ var inputType = {
20548
20608
  *
20549
20609
  * @param {string} ngModel Assignable angular expression to data-bind to.
20550
20610
  * @param {string=} name Property name of the form under which the control is published.
20551
- * @param {string=} min Sets the `min` validation error key if the value entered is less then `min`.
20552
- * @param {string=} max Sets the `max` validation error key if the value entered is greater then `min`.
20611
+ * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
20612
+ * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
20553
20613
  * @param {string=} required Sets `required` validation error key if the value is not entered.
20554
20614
  * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
20555
20615
  * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
@@ -20861,6 +20921,15 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
20861
20921
  } else {
20862
20922
  var timeout;
20863
20923
 
20924
+ var deferListener = function() {
20925
+ if (!timeout) {
20926
+ timeout = $browser.defer(function() {
20927
+ listener();
20928
+ timeout = null;
20929
+ });
20930
+ }
20931
+ };
20932
+
20864
20933
  element.bind('keydown', function(event) {
20865
20934
  var key = event.keyCode;
20866
20935
 
@@ -20868,16 +20937,16 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
20868
20937
  // command modifiers arrows
20869
20938
  if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
20870
20939
 
20871
- if (!timeout) {
20872
- timeout = $browser.defer(function() {
20873
- listener();
20874
- timeout = null;
20875
- });
20876
- }
20940
+ deferListener();
20877
20941
  });
20878
20942
 
20879
20943
  // if user paste into input using mouse, we need "change" event to catch it
20880
20944
  element.bind('change', listener);
20945
+
20946
+ // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
20947
+ if ($sniffer.hasEvent('paste')) {
20948
+ element.bind('paste cut', deferListener);
20949
+ }
20881
20950
  }
20882
20951
 
20883
20952
 
@@ -21176,7 +21245,7 @@ function checkboxInputType(scope, element, attr, ctrl) {
21176
21245
  <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>
21177
21246
  <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>
21178
21247
  <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>
21179
- <tt>myForm.userName.$error = {{myForm.lastName.$error}}</tt><br>
21248
+ <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>
21180
21249
  <tt>myForm.$valid = {{myForm.$valid}}</tt><br>
21181
21250
  <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
21182
21251
  <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>
@@ -21439,7 +21508,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
21439
21508
  * For example {@link ng.directive:input input} or
21440
21509
  * {@link ng.directive:select select} directives call it.
21441
21510
  *
21442
- * It internally calls all `formatters` and if resulted value is valid, updates the model and
21511
+ * It internally calls all `parsers` and if resulted value is valid, updates the model and
21443
21512
  * calls all registered change listeners.
21444
21513
  *
21445
21514
  * @param {string} value Value from the view.
@@ -21745,7 +21814,7 @@ var ngValueDirective = function() {
21745
21814
  * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
21746
21815
  * `{{ expression }}` which is similar but less verbose.
21747
21816
  *
21748
- * Once scenario in which the use of `ngBind` is prefered over `{{ expression }}` binding is when
21817
+ * One scenario in which the use of `ngBind` is preferred over `{{ expression }}` binding is when
21749
21818
  * it's desirable to put bindings into template that is momentarily displayed by the browser in its
21750
21819
  * raw state before Angular compiles it. Since `ngBind` is an element attribute, it makes the
21751
21820
  * bindings invisible to the user while the page is loading.
@@ -21886,9 +21955,9 @@ function classDirective(name, selector) {
21886
21955
 
21887
21956
  if (name !== 'ngClass') {
21888
21957
  scope.$watch('$index', function($index, old$index) {
21889
- var mod = $index % 2;
21890
- if (mod !== old$index % 2) {
21891
- if (mod == selector) {
21958
+ var mod = $index & 1;
21959
+ if (mod !== old$index & 1) {
21960
+ if (mod === selector) {
21892
21961
  addClass(scope.$eval(attr[name]));
21893
21962
  } else {
21894
21963
  removeClass(scope.$eval(attr[name]));
@@ -21900,12 +21969,12 @@ function classDirective(name, selector) {
21900
21969
 
21901
21970
  function ngClassWatchAction(newVal) {
21902
21971
  if (selector === true || scope.$index % 2 === selector) {
21903
- if (oldVal && (newVal !== oldVal)) {
21972
+ if (oldVal && !equals(newVal,oldVal)) {
21904
21973
  removeClass(oldVal);
21905
21974
  }
21906
21975
  addClass(newVal);
21907
21976
  }
21908
- oldVal = newVal;
21977
+ oldVal = copy(newVal);
21909
21978
  }
21910
21979
 
21911
21980
 
@@ -22031,7 +22100,7 @@ var ngClassOddDirective = classDirective('Odd', 0);
22031
22100
  * @name ng.directive:ngClassEven
22032
22101
  *
22033
22102
  * @description
22034
- * The `ngClassOdd` and `ngClassEven` works exactly as
22103
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
22035
22104
  * {@link ng.directive:ngClass ngClass}, except it works in
22036
22105
  * conjunction with `ngRepeat` and takes affect only on odd (even) rows.
22037
22106
  *
@@ -22148,8 +22217,7 @@ var ngCloakDirective = ngDirective({
22148
22217
  * * Controller — The `ngController` directive specifies a Controller class; the class has
22149
22218
  * methods that typically express the business logic behind the application.
22150
22219
  *
22151
- * Note that an alternative way to define controllers is via the `{@link ng.$route}`
22152
- * service.
22220
+ * Note that an alternative way to define controllers is via the {@link ng.$route $route} service.
22153
22221
  *
22154
22222
  * @element ANY
22155
22223
  * @scope
@@ -22240,16 +22308,32 @@ var ngControllerDirective = [function() {
22240
22308
  * @name ng.directive:ngCsp
22241
22309
  * @priority 1000
22242
22310
  *
22311
+ * @element html
22243
22312
  * @description
22244
22313
  * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support.
22245
- * This directive should be used on the root element of the application (typically the `<html>`
22246
- * element or other element with the {@link ng.directive:ngApp ngApp}
22247
- * directive).
22248
- *
22249
- * If enabled the performance of template expression evaluator will suffer slightly, so don't enable
22250
- * this mode unless you need it.
22251
- *
22252
- * @element html
22314
+ *
22315
+ * This is necessary when developing things like Google Chrome Extensions.
22316
+ *
22317
+ * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things).
22318
+ * For us to be compatible, we just need to implement the "getterFn" in $parse without violating
22319
+ * any of these restrictions.
22320
+ *
22321
+ * AngularJS uses `Function(string)` generated functions as a speed optimization. By applying `ngCsp`
22322
+ * it is be possible to opt into the CSP compatible mode. When this mode is on AngularJS will
22323
+ * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will
22324
+ * be raised.
22325
+ *
22326
+ * In order to use this feature put `ngCsp` directive on the root element of the application.
22327
+ *
22328
+ * @example
22329
+ * This example shows how to apply the `ngCsp` directive to the `html` tag.
22330
+ <pre>
22331
+ <!doctype html>
22332
+ <html ng-app ng-csp>
22333
+ ...
22334
+ ...
22335
+ </html>
22336
+ </pre>
22253
22337
  */
22254
22338
 
22255
22339
  var ngCspDirective = ['$sniffer', function($sniffer) {
@@ -22874,7 +22958,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
22874
22958
  if (!isNaN(value)) {
22875
22959
  //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise,
22876
22960
  //check it against pluralization rules in $locale service
22877
- if (!whens[value]) value = $locale.pluralCat(value - offset);
22961
+ if (!(value in whens)) value = $locale.pluralCat(value - offset);
22878
22962
  return whensExpFns[value](scope, element, true);
22879
22963
  } else {
22880
22964
  return '';
@@ -23607,7 +23691,8 @@ var scriptDirective = ['$templateCache', function($templateCache) {
23607
23691
  * `select` model to be bound to a non-string value. This is because an option element can currently
23608
23692
  * be bound to string values only.
23609
23693
  *
23610
- * @param {string} name assignable expression to data-bind to.
23694
+ * @param {string} ngModel Assignable angular expression to data-bind to.
23695
+ * @param {string=} name Property name of the form under which the control is published.
23611
23696
  * @param {string=} required The control is considered valid only if value is entered.
23612
23697
  * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
23613
23698
  * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
@@ -23974,10 +24059,6 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
23974
24059
 
23975
24060
  if (multiple) {
23976
24061
  selectedSet = new HashMap(modelValue);
23977
- } else if (modelValue === null || nullOption) {
23978
- // if we are not multiselect, and we are null then we have to add the nullOption
23979
- optionGroups[''].push({selected:modelValue === null, id:'', label:''});
23980
- selectedSet = true;
23981
24062
  }
23982
24063
 
23983
24064
  // We now build up the list of options we need (we merge later)
@@ -24002,9 +24083,14 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
24002
24083
  selected: selected // determine if we should be selected
24003
24084
  });
24004
24085
  }
24005
- if (!multiple && !selectedSet) {
24006
- // nothing was selected, we have to insert the undefined item
24007
- optionGroups[''].unshift({id:'?', label:'', selected:true});
24086
+ if (!multiple) {
24087
+ if (nullOption || modelValue === null) {
24088
+ // insert null option if we have a placeholder, or the model is null
24089
+ optionGroups[''].unshift({id:'', label:'', selected:!selectedSet});
24090
+ } else if (!selectedSet) {
24091
+ // option could not be found, we have to insert the undefined item
24092
+ optionGroups[''].unshift({id:'?', label:'', selected:true});
24093
+ }
24008
24094
  }
24009
24095
 
24010
24096
  // Now we need to update the list of DOM nodes to match the optionGroups we computed above
@@ -24048,7 +24134,8 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
24048
24134
  if (existingOption.id !== option.id) {
24049
24135
  lastElement.val(existingOption.id = option.id);
24050
24136
  }
24051
- if (existingOption.element.selected !== option.selected) {
24137
+ // lastElement.prop('selected') provided by jQuery has side-effects
24138
+ if (lastElement[0].selected !== option.selected) {
24052
24139
  lastElement.prop('selected', (existingOption.selected = option.selected));
24053
24140
  }
24054
24141
  } else {