Commit e15c5781 authored by Pascal Hartig's avatar Pascal Hartig

AngularJS: Upgrade to 1.2.7

parent 397de63c
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "todomvc-angular", "name": "todomvc-angular",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"angular": "1.2.6", "angular": "1.2.7",
"todomvc-common": "~0.1.4" "todomvc-common": "~0.1.4"
}, },
"devDependencies": { "devDependencies": {
"angular-mocks": "1.2.6", "angular-mocks": "1.2.7",
"angular-route": "1.2.6" "angular-route": "1.2.7"
} }
} }
/** /**
* @license AngularJS v1.2.6 * @license AngularJS v1.2.7
* (c) 2010-2014 Google, Inc. http://angularjs.org * (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT * License: MIT
*/ */
...@@ -842,7 +842,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) { ...@@ -842,7 +842,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
var locals = $route.current && $route.current.locals, var locals = $route.current && $route.current.locals,
template = locals && locals.$template; template = locals && locals.$template;
if (template) { if (angular.isDefined(template)) {
var newScope = scope.$new(); var newScope = scope.$new();
var current = $route.current; var current = $route.current;
......
/** /**
* @license AngularJS v1.2.6 * @license AngularJS v1.2.7
* (c) 2010-2014 Google, Inc. http://angularjs.org * (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT * License: MIT
*/ */
...@@ -68,7 +68,7 @@ function minErr(module) { ...@@ -68,7 +68,7 @@ function minErr(module) {
return match; return match;
}); });
message = message + '\nhttp://errors.angularjs.org/1.2.6/' + message = message + '\nhttp://errors.angularjs.org/1.2.7/' +
(module ? module + '/' : '') + code; (module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) { for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' + message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
...@@ -1038,7 +1038,9 @@ function fromJson(json) { ...@@ -1038,7 +1038,9 @@ function fromJson(json) {
function toBoolean(value) { function toBoolean(value) {
if (value && value.length !== 0) { if (typeof value === 'function') {
value = true;
} else if (value && value.length !== 0) {
var v = lowercase("" + value); var v = lowercase("" + value);
value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]'); value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
} else { } else {
...@@ -1831,11 +1833,11 @@ function setupModuleLoader(window) { ...@@ -1831,11 +1833,11 @@ function setupModuleLoader(window) {
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/ */
var version = { var version = {
full: '1.2.6', // all of these placeholder strings will be replaced by grunt's full: '1.2.7', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task major: 1, // package task
minor: 2, minor: 2,
dot: 6, dot: 7,
codeName: 'taco-salsafication' codeName: 'emoji-clairvoyance'
}; };
...@@ -3663,6 +3665,11 @@ function createInjector(modulesToLoad) { ...@@ -3663,6 +3665,11 @@ function createInjector(modulesToLoad) {
path.unshift(serviceName); path.unshift(serviceName);
cache[serviceName] = INSTANTIATING; cache[serviceName] = INSTANTIATING;
return cache[serviceName] = factory(serviceName); return cache[serviceName] = factory(serviceName);
} catch (err) {
if (cache[serviceName] === INSTANTIATING) {
delete cache[serviceName];
}
throw err;
} finally { } finally {
path.shift(); path.shift();
} }
...@@ -4197,8 +4204,9 @@ function Browser(window, document, $log, $sniffer) { ...@@ -4197,8 +4204,9 @@ function Browser(window, document, $log, $sniffer) {
* @param {boolean=} replace Should new url replace current history record ? * @param {boolean=} replace Should new url replace current history record ?
*/ */
self.url = function(url, replace) { self.url = function(url, replace) {
// Android Browser BFCache causes location reference to become stale. // Android Browser BFCache causes location, history reference to become stale.
if (location !== window.location) location = window.location; if (location !== window.location) location = window.location;
if (history !== window.history) history = window.history;
// setter // setter
if (url) { if (url) {
...@@ -4250,7 +4258,7 @@ function Browser(window, document, $log, $sniffer) { ...@@ -4250,7 +4258,7 @@ function Browser(window, document, $log, $sniffer) {
* @description * @description
* Register callback function that will be called, when url changes. * Register callback function that will be called, when url changes.
* *
* It's only called when the url is changed by outside of angular: * It's only called when the url is changed from outside of angular:
* - user types different url into address bar * - user types different url into address bar
* - user clicks on history (forward/back) button * - user clicks on history (forward/back) button
* - user clicks on a link * - user clicks on a link
...@@ -4292,7 +4300,7 @@ function Browser(window, document, $log, $sniffer) { ...@@ -4292,7 +4300,7 @@ function Browser(window, document, $log, $sniffer) {
/** /**
* @name ng.$browser#baseHref * @name ng.$browser#baseHref
* @methodOf ng.$browser * @methodOf ng.$browser
* *
* @description * @description
* Returns current <base href> * Returns current <base href>
* (always relative - without domain) * (always relative - without domain)
...@@ -4301,7 +4309,7 @@ function Browser(window, document, $log, $sniffer) { ...@@ -4301,7 +4309,7 @@ function Browser(window, document, $log, $sniffer) {
*/ */
self.baseHref = function() { self.baseHref = function() {
var href = baseElement.attr('href'); var href = baseElement.attr('href');
return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : ''; return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
}; };
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
...@@ -4323,13 +4331,13 @@ function Browser(window, document, $log, $sniffer) { ...@@ -4323,13 +4331,13 @@ function Browser(window, document, $log, $sniffer) {
* It is not meant to be used directly, use the $cookie service instead. * It is not meant to be used directly, use the $cookie service instead.
* *
* The return values vary depending on the arguments that the method was called with as follows: * The return values vary depending on the arguments that the method was called with as follows:
* *
* - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify
* it * it
* - cookies(name, value) -> set name to value, if value is undefined delete the cookie * - cookies(name, value) -> set name to value, if value is undefined delete the cookie
* - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that
* way) * way)
* *
* @returns {Object} Hash of all cookies (if called without any parameter) * @returns {Object} Hash of all cookies (if called without any parameter)
*/ */
self.cookies = function(name, value) { self.cookies = function(name, value) {
...@@ -4707,7 +4715,7 @@ function $TemplateCacheProvider() { ...@@ -4707,7 +4715,7 @@ function $TemplateCacheProvider() {
* @function * @function
* *
* @description * @description
* Compiles a piece of HTML string or DOM into a template and produces a template function, which * Compiles an HTML string or DOM into a template and produces a template function, which
* can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together. * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
* *
* The compilation is a process of walking the DOM tree and matching DOM elements to * The compilation is a process of walking the DOM tree and matching DOM elements to
...@@ -7049,7 +7057,7 @@ function $HttpProvider() { ...@@ -7049,7 +7057,7 @@ function $HttpProvider() {
* will result in the success callback being called. Note that if the response is a redirect, * will result in the success callback being called. Note that if the response is a redirect,
* XMLHttpRequest will transparently follow it, meaning that the error callback will not be * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
* called for such responses. * called for such responses.
* *
* # Calling $http from outside AngularJS * # Calling $http from outside AngularJS
* The `$http` service will not actually send the request until the next `$digest()` is * The `$http` service will not actually send the request until the next `$digest()` is
* executed. Normally this is not an issue, since almost all the time your call to `$http` will * executed. Normally this is not an issue, since almost all the time your call to `$http` will
...@@ -7236,19 +7244,20 @@ function $HttpProvider() { ...@@ -7236,19 +7244,20 @@ function $HttpProvider() {
* return responseOrNewPromise * return responseOrNewPromise
* } * }
* return $q.reject(rejection); * return $q.reject(rejection);
* }; * }
* } * };
* }); * });
* *
* $httpProvider.interceptors.push('myHttpInterceptor'); * $httpProvider.interceptors.push('myHttpInterceptor');
* *
* *
* // register the interceptor via an anonymous factory * // alternatively, register the interceptor via an anonymous factory
* $httpProvider.interceptors.push(function($q, dependency1, dependency2) { * $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
* return { * return {
* 'request': function(config) { * 'request': function(config) {
* // same as above * // same as above
* }, * },
*
* 'response': function(response) { * 'response': function(response) {
* // same as above * // same as above
* } * }
...@@ -7864,13 +7873,13 @@ function $HttpProvider() { ...@@ -7864,13 +7873,13 @@ function $HttpProvider() {
}]; }];
} }
var XHR = window.XMLHttpRequest || function() { function createXhr(method) {
// IE8 doesn't support PATCH method, but the ActiveX object does
/* global ActiveXObject */ /* global ActiveXObject */
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {} return (msie <= 8 && lowercase(method) === 'patch')
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {} ? new ActiveXObject('Microsoft.XMLHTTP')
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {} : new window.XMLHttpRequest();
throw minErr('$httpBackend')('noxhr', "This browser does not support XMLHttpRequest."); }
};
/** /**
...@@ -7892,11 +7901,11 @@ var XHR = window.XMLHttpRequest || function() { ...@@ -7892,11 +7901,11 @@ var XHR = window.XMLHttpRequest || function() {
*/ */
function $HttpBackendProvider() { function $HttpBackendProvider() {
this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) { this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) {
return createHttpBackend($browser, XHR, $browser.defer, $window.angular.callbacks, $document[0]); return createHttpBackend($browser, createXhr, $browser.defer, $window.angular.callbacks, $document[0]);
}]; }];
} }
function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument) { function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
var ABORTED = -1; var ABORTED = -1;
// TODO(vojta): fix the signature // TODO(vojta): fix the signature
...@@ -7921,7 +7930,9 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument) ...@@ -7921,7 +7930,9 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument)
delete callbacks[callbackId]; delete callbacks[callbackId];
}); });
} else { } else {
var xhr = new XHR();
var xhr = createXhr(method);
xhr.open(method, url, true); xhr.open(method, url, true);
forEach(headers, function(value, key) { forEach(headers, function(value, key) {
if (isDefined(value)) { if (isDefined(value)) {
...@@ -7933,7 +7944,14 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument) ...@@ -7933,7 +7944,14 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument)
// response is in the cache. the promise api will ensure that to the app code the api is // response is in the cache. the promise api will ensure that to the app code the api is
// always async // always async
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState == 4) { // onreadystatechange might by called multiple times with readyState === 4 on mobile webkit caused by
// xhrs that are resolved while the app is in the background (see #5426).
// since calling completeRequest sets the `xhr` variable to null, we just check if it's not null before
// continuing
//
// we can't set xhr.onreadystatechange to undefined or delete it because that breaks IE8 (method=PATCH) and
// Safari respectively.
if (xhr && xhr.readyState == 4) {
var responseHeaders = null, var responseHeaders = null,
response = null; response = null;
...@@ -9180,16 +9198,17 @@ function $LocationProvider(){ ...@@ -9180,16 +9198,17 @@ function $LocationProvider(){
// update $location when $browser url changes // update $location when $browser url changes
$browser.onUrlChange(function(newUrl) { $browser.onUrlChange(function(newUrl) {
if ($location.absUrl() != newUrl) { if ($location.absUrl() != newUrl) {
if ($rootScope.$broadcast('$locationChangeStart', newUrl,
$location.absUrl()).defaultPrevented) {
$browser.url($location.absUrl());
return;
}
$rootScope.$evalAsync(function() { $rootScope.$evalAsync(function() {
var oldUrl = $location.absUrl(); var oldUrl = $location.absUrl();
$location.$$parse(newUrl); $location.$$parse(newUrl);
afterLocationChange(oldUrl); if ($rootScope.$broadcast('$locationChangeStart', newUrl,
oldUrl).defaultPrevented) {
$location.$$parse(oldUrl);
$browser.url(oldUrl);
} else {
afterLocationChange(oldUrl);
}
}); });
if (!$rootScope.$$phase) $rootScope.$digest(); if (!$rootScope.$$phase) $rootScope.$digest();
} }
...@@ -11299,6 +11318,7 @@ function $RootScopeProvider(){ ...@@ -11299,6 +11318,7 @@ function $RootScopeProvider(){
this.$$asyncQueue = []; this.$$asyncQueue = [];
this.$$postDigestQueue = []; this.$$postDigestQueue = [];
this.$$listeners = {}; this.$$listeners = {};
this.$$listenerCount = {};
this.$$isolateBindings = {}; this.$$isolateBindings = {};
} }
...@@ -11358,6 +11378,7 @@ function $RootScopeProvider(){ ...@@ -11358,6 +11378,7 @@ function $RootScopeProvider(){
} }
child['this'] = child; child['this'] = child;
child.$$listeners = {}; child.$$listeners = {};
child.$$listenerCount = {};
child.$parent = this; child.$parent = this;
child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null; child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
child.$$prevSibling = this.$$childTail; child.$$prevSibling = this.$$childTail;
...@@ -11517,6 +11538,7 @@ function $RootScopeProvider(){ ...@@ -11517,6 +11538,7 @@ function $RootScopeProvider(){
return function() { return function() {
arrayRemove(array, watcher); arrayRemove(array, watcher);
lastDirtyWatch = null;
}; };
}, },
...@@ -11862,6 +11884,8 @@ function $RootScopeProvider(){ ...@@ -11862,6 +11884,8 @@ function $RootScopeProvider(){
this.$$destroyed = true; this.$$destroyed = true;
if (this === $rootScope) return; if (this === $rootScope) return;
forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling; if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling; if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
...@@ -12051,8 +12075,18 @@ function $RootScopeProvider(){ ...@@ -12051,8 +12075,18 @@ function $RootScopeProvider(){
} }
namedListeners.push(listener); namedListeners.push(listener);
var current = this;
do {
if (!current.$$listenerCount[name]) {
current.$$listenerCount[name] = 0;
}
current.$$listenerCount[name]++;
} while ((current = current.$parent));
var self = this;
return function() { return function() {
namedListeners[indexOf(namedListeners, listener)] = null; namedListeners[indexOf(namedListeners, listener)] = null;
decrementListenerCount(self, 1, name);
}; };
}, },
...@@ -12164,8 +12198,7 @@ function $RootScopeProvider(){ ...@@ -12164,8 +12198,7 @@ function $RootScopeProvider(){
listeners, i, length; listeners, i, length;
//down while you can, then up and next sibling or up and next sibling until back at root //down while you can, then up and next sibling or up and next sibling until back at root
do { while ((current = next)) {
current = next;
event.currentScope = current; event.currentScope = current;
listeners = current.$$listeners[name] || []; listeners = current.$$listeners[name] || [];
for (i=0, length = listeners.length; i<length; i++) { for (i=0, length = listeners.length; i<length; i++) {
...@@ -12187,12 +12220,14 @@ function $RootScopeProvider(){ ...@@ -12187,12 +12220,14 @@ function $RootScopeProvider(){
// Insanity Warning: scope depth-first traversal // Insanity Warning: scope depth-first traversal
// yes, this code is a bit crazy, but it works and we have tests to prove it! // yes, this code is a bit crazy, but it works and we have tests to prove it!
// this piece should be kept in sync with the traversal in $digest // this piece should be kept in sync with the traversal in $digest
if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { // (though it differs due to having the extra check for $$listenerCount)
if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
(current !== target && current.$$nextSibling)))) {
while(current !== target && !(next = current.$$nextSibling)) { while(current !== target && !(next = current.$$nextSibling)) {
current = current.$parent; current = current.$parent;
} }
} }
} while ((current = next)); }
return event; return event;
} }
...@@ -12221,6 +12256,16 @@ function $RootScopeProvider(){ ...@@ -12221,6 +12256,16 @@ function $RootScopeProvider(){
return fn; return fn;
} }
function decrementListenerCount(current, count, name) {
do {
current.$$listenerCount[name] -= count;
if (current.$$listenerCount[name] === 0) {
delete current.$$listenerCount[name];
}
} while ((current = current.$parent));
}
/** /**
* function used as an initial value for watchers. * function used as an initial value for watchers.
* because it's unique we can easily tell it apart from other values * because it's unique we can easily tell it apart from other values
...@@ -13439,7 +13484,7 @@ function $SnifferProvider() { ...@@ -13439,7 +13484,7 @@ function $SnifferProvider() {
// http://code.google.com/p/android/issues/detail?id=17471 // http://code.google.com/p/android/issues/detail?id=17471
// https://github.com/angular/angular.js/issues/904 // https://github.com/angular/angular.js/issues/904
// older webit browser (533.9) on Boxee box has exactly the same problem as Android has // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
// so let's not use the history API also // so let's not use the history API also
// We are purposefully using `!(android < 4)` to cover the case when `android` is undefined // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
// jshint -W018 // jshint -W018
...@@ -13861,21 +13906,21 @@ function $FilterProvider($provide) { ...@@ -13861,21 +13906,21 @@ function $FilterProvider($provide) {
* property of the object. That's equivalent to the simple substring match with a `string` * property of the object. That's equivalent to the simple substring match with a `string`
* as described above. * as described above.
* *
* - `function`: A predicate function can be used to write arbitrary filters. The function is * - `function(value)`: A predicate function can be used to write arbitrary filters. The function is
* called for each element of `array`. The final result is an array of those elements that * called for each element of `array`. The final result is an array of those elements that
* the predicate returned true for. * the predicate returned true for.
* *
* @param {function(expected, actual)|true|undefined} comparator Comparator which is used in * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
* determining if the expected value (from the filter expression) and actual value (from * determining if the expected value (from the filter expression) and actual value (from
* the object in the array) should be considered a match. * the object in the array) should be considered a match.
* *
* Can be one of: * Can be one of:
* *
* - `function(expected, actual)`: * - `function(actual, expected)`:
* The function will be given the object value and the predicate value to compare and * The function will be given the object value and the predicate value to compare and
* should return true if the item should be included in filtered result. * should return true if the item should be included in filtered result.
* *
* - `true`: A shorthand for `function(expected, actual) { return angular.equals(expected, actual)}`. * - `true`: A shorthand for `function(actual, expected) { return angular.equals(expected, actual)}`.
* this is essentially strict comparison of expected and actual. * this is essentially strict comparison of expected and actual.
* *
* - `false|undefined`: A short hand for a function which will look for a substring match in case * - `false|undefined`: A short hand for a function which will look for a substring match in case
...@@ -15980,9 +16025,13 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { ...@@ -15980,9 +16025,13 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
} }
if (ctrl.$viewValue !== value) { if (ctrl.$viewValue !== value) {
scope.$apply(function() { if (scope.$$phase) {
ctrl.$setViewValue(value); ctrl.$setViewValue(value);
}); } else {
scope.$apply(function() {
ctrl.$setViewValue(value);
});
}
} }
}; };
...@@ -19061,7 +19110,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { ...@@ -19061,7 +19110,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
$$tlb: true, $$tlb: true,
link: function($scope, $element, $attr, ctrl, $transclude){ link: function($scope, $element, $attr, ctrl, $transclude){
var expression = $attr.ngRepeat; var expression = $attr.ngRepeat;
var match = expression.match(/^\s*(.+)\s+in\s+([\r\n\s\S]*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),
trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn, trackByExp, trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn,
lhs, rhs, valueIdentifier, keyIdentifier, lhs, rhs, valueIdentifier, keyIdentifier,
hashFnLocals = {$id: hashKey}; hashFnLocals = {$id: hashKey};
...@@ -19073,7 +19122,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { ...@@ -19073,7 +19122,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
lhs = match[1]; lhs = match[1];
rhs = match[2]; rhs = match[2];
trackByExp = match[4]; trackByExp = match[3];
if (trackByExp) { if (trackByExp) {
trackByExpGetter = $parse(trackByExp); trackByExpGetter = $parse(trackByExp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment