summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFloran Brutel <f.brutel@hexanet.fr>2017-06-05 09:57:43 +0200
committerFloran Brutel <f.brutel@hexanet.fr>2017-06-05 09:57:43 +0200
commit17adb57ace5ab5e5178f0e4ab4b81e8274e33ea9 (patch)
tree8bbc59b6d3ff5f7697e3c550eccc0330f9688f95
parent7f45a0af315a006841042d62d2ecf1f25098758d (diff)
Remove routing system of angular
-rw-r--r--glances/outputs/static/bower.json1
-rw-r--r--glances/outputs/static/js/app.js2
-rw-r--r--glances/outputs/static/public/js/main.min.js2
-rw-r--r--glances/outputs/static/public/js/vendor.min.js2997
4 files changed, 1087 insertions, 1915 deletions
diff --git a/glances/outputs/static/bower.json b/glances/outputs/static/bower.json
index 940bc718..451aa73f 100644
--- a/glances/outputs/static/bower.json
+++ b/glances/outputs/static/bower.json
@@ -3,7 +3,6 @@
"private": true,
"dependencies": {
"angular": "^1.5.8",
- "angular-route": "^1.5.8",
"lodash": "^4.13.1",
"favico.js": "^0.3.10",
"angular-hotkeys": "chieffancypants/angular-hotkeys#^1.7.0"
diff --git a/glances/outputs/static/js/app.js b/glances/outputs/static/js/app.js
index caade0c0..b27ee436 100644
--- a/glances/outputs/static/js/app.js
+++ b/glances/outputs/static/js/app.js
@@ -1,4 +1,4 @@
-var glancesApp = angular.module('glancesApp', ['ngRoute', 'glances.config', 'cfp.hotkeys'])
+var glancesApp = angular.module('glancesApp', ['glances.config', 'cfp.hotkeys'])
.value('CONFIG', {})
.value('ARGUMENTS', {})
diff --git a/glances/outputs/static/public/js/main.min.js b/glances/outputs/static/public/js/main.min.js
index 97baf8c6..8c5a811c 100644
--- a/glances/outputs/static/public/js/main.min.js
+++ b/glances/outputs/static/public/js/main.min.js
@@ -1,4 +1,4 @@
-var glancesApp = angular.module('glancesApp', ['ngRoute', 'glances.config', 'cfp.hotkeys'])
+var glancesApp = angular.module('glancesApp', ['glances.config', 'cfp.hotkeys'])
.value('CONFIG', {})
.value('ARGUMENTS', {})
diff --git a/glances/outputs/static/public/js/vendor.min.js b/glances/outputs/static/public/js/vendor.min.js
index 0c6b6ac5..7ac0fa40 100644
--- a/glances/outputs/static/public/js/vendor.min.js
+++ b/glances/outputs/static/public/js/vendor.min.js
@@ -1,6 +1,6 @@
/**
- * @license AngularJS v1.6.1
- * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * @license AngularJS v1.6.4
+ * (c) 2010-2017 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window) {'use strict';
@@ -38,31 +38,29 @@
function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
return function() {
- var SKIP_INDEXES = 2;
-
- var templateArgs = arguments,
- code = templateArgs[0],
+ var code = arguments[0],
+ template = arguments[1],
message = '[' + (module ? module + ':' : '') + code + '] ',
- template = templateArgs[1],
+ templateArgs = sliceArgs(arguments, 2).map(function(arg) {
+ return toDebugString(arg, minErrConfig.objectMaxDepth);
+ }),
paramPrefix, i;
message += template.replace(/\{\d+\}/g, function(match) {
- var index = +match.slice(1, -1),
- shiftedIndex = index + SKIP_INDEXES;
+ var index = +match.slice(1, -1);
- if (shiftedIndex < templateArgs.length) {
- return toDebugString(templateArgs[shiftedIndex]);
+ if (index < templateArgs.length) {
+ return templateArgs[index];
}
return match;
});
- message += '\nhttp://errors.angularjs.org/1.6.1/' +
+ message += '\nhttp://errors.angularjs.org/1.6.4/' +
(module ? module + '/' : '') + code;
- for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
- message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
- encodeURIComponent(toDebugString(templateArgs[i]));
+ for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+ message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
}
return new ErrorConstructor(message);
@@ -79,6 +77,9 @@ function minErr(module, ErrorConstructor) {
splice,
push,
toString,
+ minErrConfig,
+ errorHandlingConfig,
+ isValidObjectMaxDepth,
ngMinErr,
angularModule,
uid,
@@ -128,6 +129,7 @@ function minErr(module, ErrorConstructor) {
includes,
arrayRemove,
copy,
+ simpleCompare,
equals,
csp,
jq,
@@ -194,6 +196,50 @@ var VALIDITY_STATE_PROPERTY = 'validity';
var hasOwnProperty = Object.prototype.hasOwnProperty;
+var minErrConfig = {
+ objectMaxDepth: 5
+};
+
+ /**
+ * @ngdoc function
+ * @name angular.errorHandlingConfig
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Configure several aspects of error handling in AngularJS if used as a setter or return the
+ * current configuration if used as a getter. The following options are supported:
+ *
+ * - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
+ *
+ * Omitted or undefined options will leave the corresponding configuration values unchanged.
+ *
+ * @param {Object=} config - The configuration object. May only contain the options that need to be
+ * updated. Supported keys:
+ *
+ * * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
+ * non-positive or non-numeric value, removes the max depth limit.
+ * Default: 5
+ */
+function errorHandlingConfig(config) {
+ if (isObject(config)) {
+ if (isDefined(config.objectMaxDepth)) {
+ minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
+ }
+ } else {
+ return minErrConfig;
+ }
+}
+
+/**
+ * @private
+ * @param {Number} maxDepth
+ * @return {boolean}
+ */
+function isValidObjectMaxDepth(maxDepth) {
+ return isNumber(maxDepth) && maxDepth > 0;
+}
+
/**
* @ngdoc function
* @name angular.lowercase
@@ -916,9 +962,10 @@ function arrayRemove(array, value) {
</file>
</example>
*/
-function copy(source, destination) {
+function copy(source, destination, maxDepth) {
var stackSource = [];
var stackDest = [];
+ maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN;
if (destination) {
if (isTypedArray(destination) || isArrayBuffer(destination)) {
@@ -941,35 +988,39 @@ function copy(source, destination) {
stackSource.push(source);
stackDest.push(destination);
- return copyRecurse(source, destination);
+ return copyRecurse(source, destination, maxDepth);
}
- return copyElement(source);
+ return copyElement(source, maxDepth);
- function copyRecurse(source, destination) {
+ function copyRecurse(source, destination, maxDepth) {
+ maxDepth--;
+ if (maxDepth < 0) {
+ return '...';
+ }
var h = destination.$$hashKey;
var key;
if (isArray(source)) {
for (var i = 0, ii = source.length; i < ii; i++) {
- destination.push(copyElement(source[i]));
+ destination.push(copyElement(source[i], maxDepth));
}
} else if (isBlankObject(source)) {
// createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
for (key in source) {
- destination[key] = copyElement(source[key]);
+ destination[key] = copyElement(source[key], maxDepth);
}
} else if (source && typeof source.hasOwnProperty === 'function') {
// Slow path, which must rely on hasOwnProperty
for (key in source) {
if (source.hasOwnProperty(key)) {
- destination[key] = copyElement(source[key]);
+ destination[key] = copyElement(source[key], maxDepth);
}
}
} else {
// Slowest path --- hasOwnProperty can't be called as a method
for (key in source) {
if (hasOwnProperty.call(source, key)) {
- destination[key] = copyElement(source[key]);
+ destination[key] = copyElement(source[key], maxDepth);
}
}
}
@@ -977,7 +1028,7 @@ function copy(source, destination) {
return destination;
}
- function copyElement(source) {
+ function copyElement(source, maxDepth) {
// Simple values
if (!isObject(source)) {
return source;
@@ -1006,7 +1057,7 @@ function copy(source, destination) {
stackDest.push(destination);
return needsRecurse
- ? copyRecurse(source, destination)
+ ? copyRecurse(source, destination, maxDepth)
: destination;
}
@@ -1057,6 +1108,10 @@ function copy(source, destination) {
}
+// eslint-disable-next-line no-self-compare
+function simpleCompare(a, b) { return a === b || (a !== a && b !== b); }
+
+
/**
* @ngdoc function
* @name angular.equals
@@ -1137,7 +1192,7 @@ function equals(o1, o2) {
}
} else if (isDate(o1)) {
if (!isDate(o2)) return false;
- return equals(o1.getTime(), o2.getTime());
+ return simpleCompare(o1.getTime(), o2.getTime());
} else if (isRegExp(o1)) {
if (!isRegExp(o2)) return false;
return o1.toString() === o2.toString();
@@ -1548,30 +1603,51 @@ function getNgAttribute(element, ngAttr) {
}
function allowAutoBootstrap(document) {
- if (!document.currentScript) {
+ var script = document.currentScript;
+
+ if (!script) {
+ // IE does not have `document.currentScript`
return true;
}
- var src = document.currentScript.getAttribute('src');
- var link = document.createElement('a');
- link.href = src;
- if (document.location.origin === link.origin) {
- // Same-origin resources are always allowed, even for non-whitelisted schemes.
- return true;
+
+ // If the `currentScript` property has been clobbered just return false, since this indicates a probable attack
+ if (!(script instanceof window.HTMLScriptElement || script instanceof window.SVGScriptElement)) {
+ return false;
}
- // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
- // This is to prevent angular.js bundled with browser extensions from being used to bypass the
- // content security policy in web pages and other browser extensions.
- switch (link.protocol) {
- case 'http:':
- case 'https:':
- case 'ftp:':
- case 'blob:':
- case 'file:':
- case 'data:':
+
+ var attributes = script.attributes;
+ var srcs = [attributes.getNamedItem('src'), attributes.getNamedItem('href'), attributes.getNamedItem('xlink:href')];
+
+ return srcs.every(function(src) {
+ if (!src) {
return true;
- default:
+ }
+ if (!src.value) {
return false;
- }
+ }
+
+ var link = document.createElement('a');
+ link.href = src.value;
+
+ if (document.location.origin === link.origin) {
+ // Same-origin resources are always allowed, even for non-whitelisted schemes.
+ return true;
+ }
+ // Disabled bootstrapping unless angular.js was loaded from a known scheme used on the web.
+ // This is to prevent angular.js bundled with browser extensions from being used to bypass the
+ // content security policy in web pages and other browser extensions.
+ switch (link.protocol) {
+ case 'http:':
+ case 'https:':
+ case 'ftp:':
+ case 'blob:':
+ case 'file:':
+ case 'data:':
+ return true;
+ default:
+ return false;
+ }
+ });
}
// Cached as it has to run during loading so that document.currentScript is available.
@@ -1935,7 +2011,7 @@ function bindJQuery() {
extend(jQuery.fn, {
scope: JQLitePrototype.scope,
isolateScope: JQLitePrototype.isolateScope,
- controller: JQLitePrototype.controller,
+ controller: /** @type {?} */ (JQLitePrototype).controller,
injector: JQLitePrototype.injector,
inheritedData: JQLitePrototype.inheritedData
});
@@ -2168,6 +2244,9 @@ function setupModuleLoader(window) {
* @returns {angular.Module} new module with the {@link angular.Module} api.
*/
return function module(name, requires, configFn) {
+
+ var info = {};
+
var assertNotHasOwnProperty = function(name, context) {
if (name === 'hasOwnProperty') {
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
@@ -2204,6 +2283,45 @@ function setupModuleLoader(window) {
_runBlocks: runBlocks,
/**
+ * @ngdoc method
+ * @name angular.Module#info
+ * @module ng
+ *
+ * @param {Object=} info Information about the module
+ * @returns {Object|Module} The current info object for this module if called as a getter,
+ * or `this` if called as a setter.
+ *
+ * @description
+ * Read and write custom information about this module.
+ * For example you could put the version of the module in here.
+ *
+ * ```js
+ * angular.module('myModule', []).info({ version: '1.0.0' });
+ * ```
+ *
+ * The version could then be read back out by accessing the module elsewhere:
+ *
+ * ```
+ * var version = angular.module('myModule').info().version;
+ * ```
+ *
+ * You can also retrieve this information during runtime via the
+ * {@link $injector#modules `$injector.modules`} property:
+ *
+ * ```js
+ * var version = $injector.modules['myModule'].info().version;
+ * ```
+ */
+ info: function(value) {
+ if (isDefined(value)) {
+ if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value');
+ info = value;
+ return this;
+ }
+ return info;
+ },
+
+ /**
* @ngdoc property
* @name angular.Module#requires
* @module ng
@@ -2481,9 +2599,15 @@ function shallowCopy(src, dst) {
/* global toDebugString: true */
-function serializeObject(obj) {
+function serializeObject(obj, maxDepth) {
var seen = [];
+ // There is no direct way to stringify object until reaching a specific depth
+ // and a very deep object can cause a performance issue, so we copy the object
+ // based on this specific depth and then stringify it.
+ if (isValidObjectMaxDepth(maxDepth)) {
+ obj = copy(obj, null, maxDepth);
+ }
return JSON.stringify(obj, function(key, val) {
val = toJsonReplacer(key, val);
if (isObject(val)) {
@@ -2496,13 +2620,13 @@ function serializeObject(obj) {
});
}
-function toDebugString(obj) {
+function toDebugString(obj, maxDepth) {
if (typeof obj === 'function') {
return obj.toString().replace(/ \{[\s\S]*$/, '');
} else if (isUndefined(obj)) {
return 'undefined';
} else if (typeof obj !== 'string') {
- return serializeObject(obj);
+ return serializeObject(obj, maxDepth);
}
return obj;
}
@@ -2577,7 +2701,6 @@ function toDebugString(obj) {
$$ForceReflowProvider,
$InterpolateProvider,
$IntervalProvider,
- $$HashMapProvider,
$HttpProvider,
$HttpParamSerializerProvider,
$HttpParamSerializerJQLikeProvider,
@@ -2586,6 +2709,7 @@ function toDebugString(obj) {
$jsonpCallbacksProvider,
$LocationProvider,
$LogProvider,
+ $$MapProvider,
$ParseProvider,
$RootScopeProvider,
$QProvider,
@@ -2623,16 +2747,17 @@ function toDebugString(obj) {
var version = {
// These placeholder strings will be replaced by grunt's `build` task.
// They need to be double- or single-quoted.
- full: '1.6.1',
+ full: '1.6.4',
major: 1,
minor: 6,
- dot: 1,
- codeName: 'promise-rectification'
+ dot: 4,
+ codeName: 'phenomenal-footnote'
};
function publishExternalAPI(angular) {
extend(angular, {
+ 'errorHandlingConfig': errorHandlingConfig,
'bootstrap': bootstrap,
'copy': copy,
'extend': extend,
@@ -2767,11 +2892,12 @@ function publishExternalAPI(angular) {
$window: $WindowProvider,
$$rAF: $$RAFProvider,
$$jqLite: $$jqLiteProvider,
- $$HashMap: $$HashMapProvider,
+ $$Map: $$MapProvider,
$$cookieReader: $$CookieReaderProvider
});
}
- ]);
+ ])
+ .info({ angularVersion: '1.6.4' });
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -2975,12 +3101,6 @@ function jqLiteHasData(node) {
return false;
}
-function jqLiteCleanData(nodes) {
- for (var i = 0, ii = nodes.length; i < ii; i++) {
- jqLiteRemoveData(nodes[i]);
- }
-}
-
function jqLiteBuildFragment(html, context) {
var tmp, tag, wrap,
fragment = context.createDocumentFragment(),
@@ -3083,13 +3203,10 @@ function jqLiteClone(element) {
}
function jqLiteDealoc(element, onlyDescendants) {
- if (!onlyDescendants) jqLiteRemoveData(element);
+ if (!onlyDescendants && jqLiteAcceptsData(element)) jqLite.cleanData([element]);
if (element.querySelectorAll) {
- var descendants = element.querySelectorAll('*');
- for (var i = 0, l = descendants.length; i < l; i++) {
- jqLiteRemoveData(descendants[i]);
- }
+ jqLite.cleanData(element.querySelectorAll('*'));
}
}
@@ -3387,7 +3504,11 @@ forEach({
data: jqLiteData,
removeData: jqLiteRemoveData,
hasData: jqLiteHasData,
- cleanData: jqLiteCleanData
+ cleanData: function jqLiteCleanData(nodes) {
+ for (var i = 0, ii = nodes.length; i < ii; i++) {
+ jqLiteRemoveData(nodes[i]);
+ }
+ }
}, function(fn, name) {
JQLite[name] = fn;
});
@@ -3915,50 +4036,70 @@ function hashKey(obj, nextUidFn) {
return key;
}
-/**
- * HashMap which can use objects as keys
- */
-function HashMap(array, isolatedUid) {
- if (isolatedUid) {
- var uid = 0;
- this.nextUid = function() {
- return ++uid;
- };
- }
- forEach(array, this.put, this);
-}
-HashMap.prototype = {
- /**
- * Store key value pair
- * @param key key to store can be any type
- * @param value value to store can be any type
- */
- put: function(key, value) {
- this[hashKey(key, this.nextUid)] = value;
+// A minimal ES2015 Map implementation.
+// Should be bug/feature equivalent to the native implementations of supported browsers
+// (for the features required in Angular).
+// See https://kangax.github.io/compat-table/es6/#test-Map
+var nanKey = Object.create(null);
+function NgMapShim() {
+ this._keys = [];
+ this._values = [];
+ this._lastKey = NaN;
+ this._lastIndex = -1;
+}
+NgMapShim.prototype = {
+ _idx: function(key) {
+ if (key === this._lastKey) {
+ return this._lastIndex;
+ }
+ this._lastKey = key;
+ this._lastIndex = this._keys.indexOf(key);
+ return this._lastIndex;
+ },
+ _transformKey: function(key) {
+ return isNumberNaN(key) ? nanKey : key;
},
-
- /**
- * @param key
- * @returns {Object} the value for the key
- */
get: function(key) {
- return this[hashKey(key, this.nextUid)];
+ key = this._transformKey(key);
+ var idx = this._idx(key);
+ if (idx !== -1) {
+ return this._values[idx];
+ }
},
+ set: function(key, value) {
+ key = this._transformKey(key);
+ var idx = this._idx(key);
+ if (idx === -1) {
+ idx = this._lastIndex = this._keys.length;
+ }
+ this._keys[idx] = key;
+ this._values[idx] = value;
- /**
- * Remove the key/value pair
- * @param key
- */
- remove: function(key) {
- var value = this[key = hashKey(key, this.nextUid)];
- delete this[key];
- return value;
+ // Support: IE11
+ // Do not `return this` to simulate the partial IE11 implementation
+ },
+ delete: function(key) {
+ key = this._transformKey(key);
+ var idx = this._idx(key);
+ if (idx === -1) {
+ return false;
+ }
+ this._keys.splice(idx, 1);
+ this._values.splice(idx, 1);
+ this._lastKey = NaN;
+ this._lastIndex = -1;
+ return true;
}
};
-var $$HashMapProvider = [/** @this */function() {
+// For now, always use `NgMapShim`, even if `window.Map` is available. Some native implementations
+// are still buggy (often in subtle ways) and can cause hard-to-debug failures. When native `Map`
+// implementations get more stable, we can reconsider switching to `window.Map` (when available).
+var NgMap = NgMapShim;
+
+var $$MapProvider = [/** @this */function() {
this.$get = [function() {
- return HashMap;
+ return NgMap;
}];
}];
@@ -4033,11 +4174,7 @@ var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var $injectorMinErr = minErr('$injector');
function stringifyFn(fn) {
- // Support: Chrome 50-51 only
- // Creating a new string by adding `' '` at the end, to hack around some bug in Chrome v50/51
- // (See https://github.com/angular/angular.js/issues/14487.)
- // TODO (gkalpak): Remove workaround when Chrome v52 is released
- return Function.prototype.toString.call(fn) + ' ';
+ return Function.prototype.toString.call(fn);
}
function extractArgs(fn) {
@@ -4147,6 +4284,28 @@ function annotate(fn, strictDi, name) {
*/
/**
+ * @ngdoc property
+ * @name $injector#modules
+ * @type {Object}
+ * @description
+ * A hash containing all the modules that have been loaded into the
+ * $injector.
+ *
+ * You can use this property to find out information about a module via the
+ * {@link angular.Module#info `myModule.info(...)`} method.
+ *
+ * For example:
+ *
+ * ```
+ * var info = $injector.modules['ngAnimate'].info();
+ * ```
+ *
+ * **Do not use this property to attempt to modify the modules after the application
+ * has been bootstrapped.**
+ */
+
+
+/**
* @ngdoc method
* @name $injector#get
*
@@ -4611,7 +4770,7 @@ function createInjector(modulesToLoad, strictDi) {
var INSTANTIATING = {},
providerSuffix = 'Provider',
path = [],
- loadedModules = new HashMap([], true),
+ loadedModules = new NgMap(),
providerCache = {
$provide: {
provider: supportObject(provider),
@@ -4639,6 +4798,7 @@ function createInjector(modulesToLoad, strictDi) {
instanceInjector = protoInstanceInjector;
providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
+ instanceInjector.modules = providerInjector.modules = createMap();
var runBlocks = loadModules(modulesToLoad);
instanceInjector = protoInstanceInjector.get('$injector');
instanceInjector.strictDi = strictDi;
@@ -4719,7 +4879,7 @@ function createInjector(modulesToLoad, strictDi) {
var runBlocks = [], moduleFn;
forEach(modulesToLoad, function(module) {
if (loadedModules.get(module)) return;
- loadedModules.put(module, true);
+ loadedModules.set(module, true);
function runInvokeQueue(queue) {
var i, ii;
@@ -4734,6 +4894,7 @@ function createInjector(modulesToLoad, strictDi) {
try {
if (isString(module)) {
moduleFn = angularModule(module);
+ instanceInjector.modules[module] = moduleFn;
runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
runInvokeQueue(moduleFn._invokeQueue);
runInvokeQueue(moduleFn._configBlocks);
@@ -5205,7 +5366,7 @@ var $$CoreAnimateJsProvider = /** @this */ function() {
// this is prefixed with Core since it conflicts with
// the animateQueueProvider defined in ngAnimate/animateQueue.js
var $$CoreAnimateQueueProvider = /** @this */ function() {
- var postDigestQueue = new HashMap();
+ var postDigestQueue = new NgMap();
var postDigestElements = [];
this.$get = ['$$AnimateRunner', '$rootScope',
@@ -5284,7 +5445,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
jqLiteRemoveClass(elm, toRemove);
}
});
- postDigestQueue.remove(element);
+ postDigestQueue.delete(element);
}
});
postDigestElements.length = 0;
@@ -5299,7 +5460,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
if (classesAdded || classesRemoved) {
- postDigestQueue.put(element, data);
+ postDigestQueue.set(element, data);
postDigestElements.push(element);
if (postDigestElements.length === 1) {
@@ -5324,6 +5485,7 @@ var $$CoreAnimateQueueProvider = /** @this */ function() {
*/
var $AnimateProvider = ['$provide', /** @this */ function($provide) {
var provider = this;
+ var classNameFilter = null;
this.$$registeredAnimations = Object.create(null);
@@ -5392,15 +5554,16 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
*/
this.classNameFilter = function(expression) {
if (arguments.length === 1) {
- this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
- if (this.$$classNameFilter) {
- var reservedRegex = new RegExp('(\\s+|\\/)' + NG_ANIMATE_CLASSNAME + '(\\s+|\\/)');
- if (reservedRegex.test(this.$$classNameFilter.toString())) {
- throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+ classNameFilter = (expression instanceof RegExp) ? expression : null;
+ if (classNameFilter) {
+ var reservedRegex = new RegExp('[(\\s|\\/)]' + NG_ANIMATE_CLASSNAME + '[(\\s|\\/)]');
+ if (reservedRegex.test(classNameFilter.toString())) {
+ classNameFilter = null;
+ throw $animateMinErr('nongcls', '$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
}
}
}
- return this.$$classNameFilter;
+ return classNameFilter;
};
this.$get = ['$$animateQueue', function($$animateQueue) {
@@ -6159,7 +6322,6 @@ function Browser(window, document, $log, $sniffer) {
};
cacheState();
- lastHistoryState = cachedState;
/**
* @name $browser#url
@@ -6213,8 +6375,6 @@ function Browser(window, document, $log, $sniffer) {
if ($sniffer.history && (!sameBase || !sameState)) {
history[replace ? 'replaceState' : 'pushState'](state, '', url);
cacheState();
- // Do the assignment again so that those two variables are referentially identical.
- lastHistoryState = cachedState;
} else {
if (!sameBase) {
pendingLocation = url;
@@ -6263,8 +6423,7 @@ function Browser(window, document, $log, $sniffer) {
function cacheStateAndFireUrlChange() {
pendingLocation = null;
- cacheState();
- fireUrlChange();
+ fireStateOrUrlChange();
}
// This variable should be used *only* inside the cacheState function.
@@ -6278,11 +6437,16 @@ function Browser(window, document, $log, $sniffer) {
if (equals(cachedState, lastCachedState)) {
cachedState = lastCachedState;
}
+
lastCachedState = cachedState;
+ lastHistoryState = cachedState;
}
- function fireUrlChange() {
- if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
+ function fireStateOrUrlChange() {
+ var prevLastHistoryState = lastHistoryState;
+ cacheState();
+
+ if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) {
return;
}
@@ -6317,8 +6481,8 @@ function Browser(window, document, $log, $sniffer) {
self.onUrlChange = function(callback) {
// TODO(vojta): refactor to use node's syntax for events
if (!urlChangeInit) {
- // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
- // don't fire popstate when user change the address bar and don't fire hashchange when url
+ // We listen on both (hashchange/popstate) when available, as some browsers don't
+ // fire popstate when user changes the address bar and don't fire hashchange when url
// changed by push/replaceState
// html5 history api - popstate event
@@ -6348,7 +6512,7 @@ function Browser(window, document, $log, $sniffer) {
* Needs to be exported to be able to check for changes that have been done in sync,
* as hashchange/popstate events fire in async.
*/
- self.$$checkUrlChange = fireUrlChange;
+ self.$$checkUrlChange = fireStateOrUrlChange;
//////////////////////////////////////////////////////////////
// Misc API
@@ -6471,7 +6635,7 @@ function $BrowserProvider() {
<input ng-model="newCacheValue" placeholder="Value">
<button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
- <p ng-show="keys.length">Cached Values</p>
+ <p ng-if="keys.length">Cached Values</p>
<div ng-repeat="key in keys">
<span ng-bind="key"></span>
<span>: </span>
@@ -6958,7 +7122,8 @@ function $TemplateCacheProvider() {
* * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The
* `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an
* object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a
- * component such as cloning the bound value to prevent accidental mutation of the outer value.
+ * component such as cloning the bound value to prevent accidental mutation of the outer value. Note that this will
+ * also be called when your bindings are initialized.
* * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on
* changes. Any actions that you wish to take in response to the changes that you detect must be
* invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook
@@ -7106,10 +7271,12 @@ function $TemplateCacheProvider() {
* the directive's element. If multiple directives on the same element request a new scope,
* only one new scope is created.
*
- * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
- * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
- * scope. This is useful when creating reusable components, which should not accidentally read or modify
- * data in the parent scope.
+ * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's template.
+ * The 'isolate' scope differs from normal scope in that it does not prototypically
+ * inherit from its parent scope. This is useful when creating reusable components, which should not
+ * accidentally read or modify data in the parent scope. Note that an isolate scope
+ * directive without a `template` or `templateUrl` will not apply the isolate scope
+ * to its children elements.
*
* The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the
* directive's element. These local properties are useful for aliasing values for templates. The keys in
@@ -7202,9 +7369,9 @@ function $TemplateCacheProvider() {
* initialized.
*
* <div class="alert alert-warning">
- * **Deprecation warning:** although bindings for non-ES6 class controllers are currently
- * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization
- * code that relies upon bindings inside a `$onInit` method on the controller, instead.
+ * **Deprecation warning:** if `$compileProcvider.preAssignBindingsEnabled(true)` was called, bindings for non-ES6 class
+ * controllers are bound to `this` before the controller constructor is called but this use is now deprecated. Please
+ * place initialization code that relies upon bindings inside a `$onInit` method on the controller, instead.
* </div>
*
* It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
@@ -7813,7 +7980,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
var bindingCache = createMap();
function parseIsolateBindings(scope, directiveName, isController) {
- var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
+ var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([\w$]*)\s*$/;
var bindings = createMap();
@@ -8217,7 +8384,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
*
* If disabled (false), the compiler calls the constructor first before assigning bindings.
*
- * The default value is true in Angular 1.5.x but will switch to false in Angular 1.6.x.
+ * The default value is false.
+ *
+ * @deprecated
+ * sinceVersion="1.6.0"
+ * removeVersion="1.7.0"
+ *
+ * This method and the option to assign the bindings before calling the controller's constructor
+ * will be removed in v1.7.0.
*/
var preAssignBindingsEnabled = false;
this.preAssignBindingsEnabled = function(enabled) {
@@ -9985,7 +10159,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (error instanceof Error) {
$exceptionHandler(error);
}
- }).catch(noop);
+ });
return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
var childBoundTranscludeFn = boundTranscludeFn;
@@ -10307,8 +10481,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
if (parentGet.literal) {
compare = equals;
} else {
- // eslint-disable-next-line no-self-compare
- compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };
+ compare = simpleCompare;
}
parentSet = parentGet.assign || function() {
// reset the change, or we will throw this exception on every $digest
@@ -10383,9 +10556,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
});