summaryrefslogtreecommitdiffstats
path: root/js/vendor/angular/angular.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/angular/angular.js')
-rw-r--r--js/vendor/angular/angular.js100
1 files changed, 69 insertions, 31 deletions
diff --git a/js/vendor/angular/angular.js b/js/vendor/angular/angular.js
index 72673ba79..85f2bdcee 100644
--- a/js/vendor/angular/angular.js
+++ b/js/vendor/angular/angular.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.4.0-build.3911+sha.e57138d
+ * @license AngularJS v1.4.0-build.3924+sha.e5d1d65
* (c) 2010-2015 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -57,7 +57,7 @@ function minErr(module, ErrorConstructor) {
return match;
});
- message += '\nhttp://errors.angularjs.org/1.4.0-build.3911+sha.e57138d/' +
+ message += '\nhttp://errors.angularjs.org/1.4.0-build.3924+sha.e5d1d65/' +
(module ? module + '/' : '') + code;
for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
@@ -2275,7 +2275,7 @@ function toDebugString(obj) {
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/
var version = {
- full: '1.4.0-build.3911+sha.e57138d', // all of these placeholder strings will be replaced by grunt's
+ full: '1.4.0-build.3924+sha.e5d1d65', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task
minor: 4,
dot: 0,
@@ -6570,6 +6570,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
return bindings;
}
+ function assertValidDirectiveName(name) {
+ var letter = name.charAt(0);
+ if (!letter || letter !== lowercase(letter)) {
+ throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
+ }
+ return name;
+ }
+
/**
* @ngdoc method
* @name $compileProvider#directive
@@ -6588,6 +6596,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
this.directive = function registerDirective(name, directiveFactory) {
assertNotHasOwnProperty(name, 'directive');
if (isString(name)) {
+ assertValidDirectiveName(name);
assertArg(directiveFactory, 'directiveFactory');
if (!hasDirectives.hasOwnProperty(name)) {
hasDirectives[name] = [];
@@ -9554,6 +9563,8 @@ function $HttpProvider() {
}
promise.success = function(fn) {
+ assertArgFn(fn, 'fn');
+
promise.then(function(response) {
fn(response.data, response.status, response.headers, config);
});
@@ -9561,6 +9572,8 @@ function $HttpProvider() {
};
promise.error = function(fn) {
+ assertArgFn(fn, 'fn');
+
promise.then(null, function(response) {
fn(response.data, response.status, response.headers, config);
});
@@ -10041,7 +10054,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
};
function jsonpReq(url, callbackId, done) {
- // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
+ // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:
// - fetches local scripts via XHR and evals them
// - adds and immediately removes script elements from the document
var script = rawDocument.createElement('script'), callback = null;
@@ -10077,7 +10090,17 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
}
}
-var $interpolateMinErr = minErr('$interpolate');
+var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
+$interpolateMinErr.throwNoconcat = function(text) {
+ throw $interpolateMinErr('noconcat',
+ "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+ "interpolations that concatenate multiple expressions when a trusted value is " +
+ "required. See http://docs.angularjs.org/api/ng.$sce", text);
+};
+
+$interpolateMinErr.interr = function(text, err) {
+ return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
+};
/**
* @ngdoc provider
@@ -10321,10 +10344,7 @@ function $InterpolateProvider() {
// make it obvious that you bound the value to some user controlled value. This helps reduce
// the load when auditing for XSS issues.
if (trustedContext && concat.length > 1) {
- throw $interpolateMinErr('noconcat',
- "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
- "interpolations that concatenate multiple expressions when a trusted value is " +
- "required. See http://docs.angularjs.org/api/ng.$sce", text);
+ $interpolateMinErr.throwNoconcat(text);
}
if (!mustHaveExpression || expressions.length) {
@@ -10354,9 +10374,7 @@ function $InterpolateProvider() {
return compute(values);
} catch (err) {
- var newErr = $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text,
- err.toString());
- $exceptionHandler(newErr);
+ $exceptionHandler($interpolateMinErr.interr(text, err));
}
}, {
@@ -10381,9 +10399,7 @@ function $InterpolateProvider() {
value = getValue(value);
return allOrNothing && !isDefined(value) ? value : stringify(value);
} catch (err) {
- var newErr = $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text,
- err.toString());
- $exceptionHandler(newErr);
+ $exceptionHandler($interpolateMinErr.interr(text, err));
}
}
}
@@ -15198,13 +15214,12 @@ function $RootScopeProvider() {
* clean up DOM bindings before an element is removed from the DOM.
*/
$destroy: function() {
- // we can't destroy the root scope or a scope that has been already destroyed
+ // We can't destroy a scope that has been already destroyed.
if (this.$$destroyed) return;
var parent = this.$parent;
this.$broadcast('$destroy');
this.$$destroyed = true;
- if (this === $rootScope) return;
incrementWatchersCount(this, -this.$$watchersCount);
for (var eventName in this.$$listenerCount) {
@@ -15213,8 +15228,8 @@ function $RootScopeProvider() {
// sever all the references to parent scopes (after this cleanup, the current scope should
// not be retained by any of our references and should be eligible for garbage collection)
- if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
- if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+ if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+ if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
@@ -20278,7 +20293,11 @@ var inputType = {
* Text input with number validation and transformation. Sets the `number` validation
* error if not a valid number.
*
- * The model must always be a number, otherwise Angular will throw an error.
+ * <div class="alert alert-warning">
+ * The model must always be of type `number` otherwise Angular will throw an error.
+ * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}
+ * error docs for more information and an example of how to convert your model if necessary.
+ * </div>
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} name Property name of the form under which the control is published.
@@ -21691,12 +21710,15 @@ function classDirective(name, selector) {
}
function arrayClasses(classVal) {
+ var classes = [];
if (isArray(classVal)) {
- return classVal.join(' ').split(' ');
+ forEach(classVal, function(v) {
+ classes = classes.concat(arrayClasses(v));
+ });
+ return classes;
} else if (isString(classVal)) {
return classVal.split(' ');
} else if (isObject(classVal)) {
- var classes = [];
forEach(classVal, function(v, k) {
if (v) {
classes = classes.concat(k.split(' '));
@@ -21724,16 +21746,18 @@ function classDirective(name, selector) {
* 1. If the expression evaluates to a string, the string should be one or more space-delimited class
* names.
*
- * 2. If the expression evaluates to an array, each element of the array should be a string that is
- * one or more space-delimited class names.
- *
- * 3. If the expression evaluates to an object, then for each key-value pair of the
+ * 2. If the expression evaluates to an object, then for each key-value pair of the
* object with a truthy value the corresponding key is used as a class name.
*
+ * 3. If the expression evaluates to an array, each element of the array should either be a string as in
+ * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
+ * to give you more control over what CSS classes appear. See the code below for an example of this.
+ *
+ *
* The directive won't add duplicate classes if a particular class was already set.
*
- * When the expression changes, the previously added classes are removed and only then the
- * new classes are added.
+ * When the expression changes, the previously added classes are removed and only then are the
+ * new classes added.
*
* @animations
* **add** - happens just before the class is applied to the elements
@@ -21762,10 +21786,14 @@ function classDirective(name, selector) {
<input ng-model="style1" placeholder="Type: bold, strike or red"><br>
<input ng-model="style2" placeholder="Type: bold, strike or red"><br>
<input ng-model="style3" placeholder="Type: bold, strike or red"><br>
+ <hr>
+ <p ng-class="[style4, {orange: warning}]">Using Array and Map Syntax</p>
+ <input ng-model="style4" placeholder="Type: bold, strike"><br>
+ <input type="checkbox" ng-model="warning"> warning (apply "orange" class)
</file>
<file name="style.css">
.strike {
- text-decoration: line-through;
+ text-decoration: line-through;
}
.bold {
font-weight: bold;
@@ -21773,6 +21801,9 @@ function classDirective(name, selector) {
.red {
color: red;
}
+ .orange {
+ color: orange;
+ }
</file>
<file name="protractor.js" type="protractor">
var ps = element.all(by.css('p'));
@@ -21797,11 +21828,18 @@ function classDirective(name, selector) {
});
it('array example should have 3 classes', function() {
- expect(ps.last().getAttribute('class')).toBe('');
+ expect(ps.get(2).getAttribute('class')).toBe('');
element(by.model('style1')).sendKeys('bold');
element(by.model('style2')).sendKeys('strike');
element(by.model('style3')).sendKeys('red');
- expect(ps.last().getAttribute('class')).toBe('bold strike red');
+ expect(ps.get(2).getAttribute('class')).toBe('bold strike red');
+ });
+
+ it('array with map example should have 2 classes', function() {
+ expect(ps.last().getAttribute('class')).toBe('');
+ element(by.model('style4')).sendKeys('bold');
+ element(by.model('warning')).click();
+ expect(ps.last().getAttribute('class')).toBe('bold orange');
});
</file>
</example>