Commit a0a139c2 authored by Pascal Hartig's avatar Pascal Hartig

angularjs_require: upgrade to 1.2.2

parent 28538a24
/** /**
* @license AngularJS v1.2.1 * @license AngularJS v1.2.2
* (c) 2010-2012 Google, Inc. http://angularjs.org * (c) 2010-2012 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.1/' + message = message + '\nhttp://errors.angularjs.org/1.2.2/' +
(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) + '=' +
...@@ -159,7 +159,7 @@ function minErr(module) { ...@@ -159,7 +159,7 @@ function minErr(module) {
-assertArgFn, -assertArgFn,
-assertNotHasOwnProperty, -assertNotHasOwnProperty,
-getter, -getter,
-getBlockElements -getBlockElements,
*/ */
...@@ -1181,26 +1181,38 @@ function encodeUriQuery(val, pctEncodeSpaces) { ...@@ -1181,26 +1181,38 @@ function encodeUriQuery(val, pctEncodeSpaces) {
* *
* @description * @description
* *
* Use this directive to auto-bootstrap an application. Only * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
* one ngApp directive can be used per HTML document. The directive * designates the **root element** of the application and is typically placed near the root element
* designates the root of the application and is typically placed * of the page - e.g. on the `<body>` or `<html>` tags.
* at the root of the page.
* *
* The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
* an HTML document you must manually bootstrap them using {@link angular.bootstrap}. * found in the document will be used to define the root element to auto-bootstrap as an
* Applications cannot be nested. * application. To run multiple applications in an HTML document you must manually bootstrap them using
* {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.
* *
* In the example below if the `ngApp` directive were not placed * You can specify an **AngularJS module** to be used as the root module for the application. This
* on the `html` element then the document would not be compiled * module will be loaded into the {@link AUTO.$injector} when the application is bootstrapped and
* and the `{{ 1+2 }}` would not be resolved to `3`. * should contain the application code needed or have dependencies on other modules that will
* contain the code. See {@link angular.module} for more information.
* *
* `ngApp` is the easiest way to bootstrap an application. * In the example below if the `ngApp` directive were not placed on the `html` element then the
* document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
* would not be resolved to `3`.
* *
<doc:example> * `ngApp` is the easiest, and most common, way to bootstrap an application.
<doc:source> *
I can add: 1 + 2 = {{ 1+2 }} <example module="ngAppDemo">
</doc:source> <file name="index.html">
</doc:example> <div ng-controller="ngAppDemoController">
I can add: {{a}} + {{b}} = {{ a+b }}
</file>
<file name="script.js">
angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
$scope.a = 1;
$scope.b = 2;
});
</file>
</example>
* *
*/ */
function angularInit(element, bootstrap) { function angularInit(element, bootstrap) {
...@@ -1435,7 +1447,12 @@ function setupModuleLoader(window) { ...@@ -1435,7 +1447,12 @@ function setupModuleLoader(window) {
return obj[name] || (obj[name] = factory()); return obj[name] || (obj[name] = factory());
} }
return ensure(ensure(window, 'angular', Object), 'module', function() { var angular = ensure(window, 'angular', Object);
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
angular.$$minErr = angular.$$minErr || minErr;
return ensure(angular, 'module', function() {
/** @type {Object.<string, angular.Module>} */ /** @type {Object.<string, angular.Module>} */
var modules = {}; var modules = {};
...@@ -1808,11 +1825,11 @@ function setupModuleLoader(window) { ...@@ -1808,11 +1825,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.1', // all of these placeholder strings will be replaced by grunt's full: '1.2.2', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task major: 1, // package task
minor: 2, minor: 2,
dot: 1, dot: 2,
codeName: 'underscore-empathy' codeName: 'consciousness-inertia'
}; };
...@@ -3359,11 +3376,11 @@ function annotate(fn) { ...@@ -3359,11 +3376,11 @@ function annotate(fn) {
* @example * @example
* Here are some examples of creating value services. * Here are some examples of creating value services.
* <pre> * <pre>
* $provide.constant('ADMIN_USER', 'admin'); * $provide.value('ADMIN_USER', 'admin');
* *
* $provide.constant('RoleLookup', { admin: 0, writer: 1, reader: 2 }); * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
* *
* $provide.constant('halfOf', function(value) { * $provide.value('halfOf', function(value) {
* return value / 2; * return value / 2;
* }); * });
* </pre> * </pre>
...@@ -3849,13 +3866,14 @@ var $AnimateProvider = ['$provide', function($provide) { ...@@ -3849,13 +3866,14 @@ var $AnimateProvider = ['$provide', function($provide) {
* inserted into the DOM * inserted into the DOM
*/ */
enter : function(element, parent, after, done) { enter : function(element, parent, after, done) {
var afterNode = after && after[after.length - 1]; if (after) {
var parentNode = parent && parent[0] || afterNode && afterNode.parentNode; after.after(element);
// IE does not like undefined so we have to pass null. } else {
var afterNextSibling = (afterNode && afterNode.nextSibling) || null; if (!parent || !parent[0]) {
forEach(element, function(node) { parent = after.parent();
parentNode.insertBefore(node, afterNextSibling); }
}); parent.append(element);
}
done && $timeout(done, 0, false); done && $timeout(done, 0, false);
}, },
...@@ -5260,6 +5278,24 @@ function $CompileProvider($provide) { ...@@ -5260,6 +5278,24 @@ function $CompileProvider($provide) {
} }
}, },
/**
* @ngdoc function
* @name ng.$compile.directive.Attributes#$updateClass
* @methodOf ng.$compile.directive.Attributes
* @function
*
* @description
* Adds and removes the appropriate CSS class values to the element based on the difference
* between the new and old CSS class values (specified as newClasses and oldClasses).
*
* @param {string} newClasses The current CSS className value
* @param {string} oldClasses The former CSS className value
*/
$updateClass : function(newClasses, oldClasses) {
this.$removeClass(tokenDifference(oldClasses, newClasses));
this.$addClass(tokenDifference(newClasses, oldClasses));
},
/** /**
* Set a normalized attribute on the element in a way such that all directives * Set a normalized attribute on the element in a way such that all directives
* can share the attribute. This function properly handles boolean attributes. * can share the attribute. This function properly handles boolean attributes.
...@@ -5270,15 +5306,10 @@ function $CompileProvider($provide) { ...@@ -5270,15 +5306,10 @@ function $CompileProvider($provide) {
* @param {string=} attrName Optional none normalized name. Defaults to key. * @param {string=} attrName Optional none normalized name. Defaults to key.
*/ */
$set: function(key, value, writeAttr, attrName) { $set: function(key, value, writeAttr, attrName) {
//special case for class attribute addition + removal // TODO: decide whether or not to throw an error if "class"
//so that class changes can tap into the animation //is set through this function since it may cause $updateClass to
//hooks provided by the $animate service //become unstable.
if(key == 'class') {
value = value || '';
var current = this.$$element.attr('class') || '';
this.$removeClass(tokenDifference(current, value).join(' '));
this.$addClass(tokenDifference(value, current).join(' '));
} else {
var booleanKey = getBooleanAttrName(this.$$element[0], key), var booleanKey = getBooleanAttrName(this.$$element[0], key),
normalizedVal, normalizedVal,
nodeName; nodeName;
...@@ -5324,7 +5355,6 @@ function $CompileProvider($provide) { ...@@ -5324,7 +5355,6 @@ function $CompileProvider($provide) {
this.$$element.attr(attrName, value); this.$$element.attr(attrName, value);
} }
} }
}
// fire observers // fire observers
var $$observers = this.$$observers; var $$observers = this.$$observers;
...@@ -5335,22 +5365,6 @@ function $CompileProvider($provide) { ...@@ -5335,22 +5365,6 @@ function $CompileProvider($provide) {
$exceptionHandler(e); $exceptionHandler(e);
} }
}); });
function tokenDifference(str1, str2) {
var values = [],
tokens1 = str1.split(/\s+/),
tokens2 = str2.split(/\s+/);
outer:
for(var i=0;i<tokens1.length;i++) {
var token = tokens1[i];
for(var j=0;j<tokens2.length;j++) {
if(token == tokens2[j]) continue outer;
}
values.push(token);
}
return values;
}
}, },
...@@ -6372,9 +6386,14 @@ function $CompileProvider($provide) { ...@@ -6372,9 +6386,14 @@ function $CompileProvider($provide) {
function getTrustedContext(node, attrNormalizedName) { function getTrustedContext(node, attrNormalizedName) {
if (attrNormalizedName == "srcdoc") {
return $sce.HTML;
}
var tag = nodeName_(node);
// maction[xlink:href] can source SVG. It's not limited to <maction>. // maction[xlink:href] can source SVG. It's not limited to <maction>.
if (attrNormalizedName == "xlinkHref" || if (attrNormalizedName == "xlinkHref" ||
(nodeName_(node) != "IMG" && (attrNormalizedName == "src" || (tag == "FORM" && attrNormalizedName == "action") ||
(tag != "IMG" && (attrNormalizedName == "src" ||
attrNormalizedName == "ngSrc"))) { attrNormalizedName == "ngSrc"))) {
return $sce.RESOURCE_URL; return $sce.RESOURCE_URL;
} }
...@@ -6420,8 +6439,18 @@ function $CompileProvider($provide) { ...@@ -6420,8 +6439,18 @@ function $CompileProvider($provide) {
attr[name] = interpolateFn(scope); attr[name] = interpolateFn(scope);
($$observers[name] || ($$observers[name] = [])).$$inter = true; ($$observers[name] || ($$observers[name] = [])).$$inter = true;
(attr.$$observers && attr.$$observers[name].$$scope || scope). (attr.$$observers && attr.$$observers[name].$$scope || scope).
$watch(interpolateFn, function interpolateFnWatchAction(value) { $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
attr.$set(name, value); //special case for class attribute addition + removal
//so that class changes can tap into the animation
//hooks provided by the $animate service. Be sure to
//skip animations when the first digest occurs (when
//both the new and the old values are the same) since
//the CSS classes are the non-interpolated values
if(name === 'class' && newValue != oldValue) {
attr.$updateClass(newValue, oldValue);
} else {
attr.$set(name, newValue);
}
}); });
} }
}; };
...@@ -6563,6 +6592,22 @@ function directiveLinkingFn( ...@@ -6563,6 +6592,22 @@ function directiveLinkingFn(
/* function(Function) */ boundTranscludeFn /* function(Function) */ boundTranscludeFn
){} ){}
function tokenDifference(str1, str2) {
var values = '',
tokens1 = str1.split(/\s+/),
tokens2 = str2.split(/\s+/);
outer:
for(var i = 0; i < tokens1.length; i++) {
var token = tokens1[i];
for(var j = 0; j < tokens2.length; j++) {
if(token == tokens2[j]) continue outer;
}
values += (values.length > 0 ? ' ' : '') + token;
}
return values;
}
/** /**
* @ngdoc object * @ngdoc object
* @name ng.$controllerProvider * @name ng.$controllerProvider
...@@ -7779,6 +7824,8 @@ function $HttpBackendProvider() { ...@@ -7779,6 +7824,8 @@ function $HttpBackendProvider() {
} }
function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) { function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) {
var ABORTED = -1;
// TODO(vojta): fix the signature // TODO(vojta): fix the signature
return function(method, url, post, callback, headers, timeout, withCredentials, responseType) { return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
var status; var status;
...@@ -7814,13 +7861,19 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, ...@@ -7814,13 +7861,19 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
// always async // always async
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState == 4) { if (xhr.readyState == 4) {
var responseHeaders = xhr.getAllResponseHeaders(); var responseHeaders = null,
response = null;
if(status !== ABORTED) {
responseHeaders = xhr.getAllResponseHeaders();
response = xhr.responseType ? xhr.response : xhr.responseText;
}
// responseText is the old-school way of retrieving response (supported by IE8 & 9) // responseText is the old-school way of retrieving response (supported by IE8 & 9)
// response/responseType properties were introduced in XHR Level2 spec (supported by IE10) // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
completeRequest(callback, completeRequest(callback,
status || xhr.status, status || xhr.status,
(xhr.responseType ? xhr.response : xhr.responseText), response,
responseHeaders); responseHeaders);
} }
}; };
...@@ -7844,7 +7897,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, ...@@ -7844,7 +7897,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
function timeoutRequest() { function timeoutRequest() {
status = -1; status = ABORTED;
jsonpDone && jsonpDone(); jsonpDone && jsonpDone();
xhr && xhr.abort(); xhr && xhr.abort();
} }
...@@ -7873,6 +7926,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, ...@@ -7873,6 +7926,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
// - adds and immediately removes script elements from the document // - adds and immediately removes script elements from the document
var script = rawDocument.createElement('script'), var script = rawDocument.createElement('script'),
doneWrapper = function() { doneWrapper = function() {
script.onreadystatechange = script.onload = script.onerror = null;
rawDocument.body.removeChild(script); rawDocument.body.removeChild(script);
if (done) done(); if (done) done();
}; };
...@@ -7880,12 +7934,16 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, ...@@ -7880,12 +7934,16 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
script.type = 'text/javascript'; script.type = 'text/javascript';
script.src = url; script.src = url;
if (msie) { if (msie && msie <= 8) {
script.onreadystatechange = function() { script.onreadystatechange = function() {
if (/loaded|complete/.test(script.readyState)) doneWrapper(); if (/loaded|complete/.test(script.readyState)) {
doneWrapper();
}
}; };
} else { } else {
script.onload = script.onerror = doneWrapper; script.onload = script.onerror = function() {
doneWrapper();
};
} }
rawDocument.body.appendChild(script); rawDocument.body.appendChild(script);
...@@ -8962,7 +9020,7 @@ function $LocationProvider(){ ...@@ -8962,7 +9020,7 @@ function $LocationProvider(){
* *
* The main purpose of this service is to simplify debugging and troubleshooting. * The main purpose of this service is to simplify debugging and troubleshooting.
* *
* The default is not to log `debug` messages. You can use * The default is to log `debug` messages. You can use
* {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this. * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
* *
* @example * @example
...@@ -10128,7 +10186,7 @@ function getterFn(path, options, fullExp) { ...@@ -10128,7 +10186,7 @@ function getterFn(path, options, fullExp) {
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' + : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
(options.unwrapPromises (options.unwrapPromises
? 'if (s && s.then) {\n' + ? 'if (s && s.then) {\n' +
' pw("' + fullExp.replace(/\"/g, '\\"') + '");\n' + ' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +
' if (!("$$v" in s)) {\n' + ' if (!("$$v" in s)) {\n' +
' p=s;\n' + ' p=s;\n' +
' p.$$v = undefined;\n' + ' p.$$v = undefined;\n' +
...@@ -12098,8 +12156,7 @@ function $SceDelegateProvider() { ...@@ -12098,8 +12156,7 @@ function $SceDelegateProvider() {
return resourceUrlBlacklist; return resourceUrlBlacklist;
}; };
this.$get = ['$log', '$document', '$injector', function( this.$get = ['$injector', function($injector) {
$log, $document, $injector) {
var htmlSanitizer = function htmlSanitizer(html) { var htmlSanitizer = function htmlSanitizer(html) {
throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
...@@ -12630,19 +12687,16 @@ function $SceProvider() { ...@@ -12630,19 +12687,16 @@ function $SceProvider() {
* sce.js and sceSpecs.js would need to be aware of this detail. * sce.js and sceSpecs.js would need to be aware of this detail.
*/ */
this.$get = ['$parse', '$document', '$sceDelegate', function( this.$get = ['$parse', '$sniffer', '$sceDelegate', function(
$parse, $document, $sceDelegate) { $parse, $sniffer, $sceDelegate) {
// Prereq: Ensure that we're not running in IE8 quirks mode. In that mode, IE allows // Prereq: Ensure that we're not running in IE8 quirks mode. In that mode, IE allows
// the "expression(javascript expression)" syntax which is insecure. // the "expression(javascript expression)" syntax which is insecure.
if (enabled && msie) { if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {
var documentMode = $document[0].documentMode;
if (documentMode !== undefined && documentMode < 8) {
throw $sceMinErr('iequirks', throw $sceMinErr('iequirks',
'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' + 'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' +
'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' + 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +
'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
} }
}
var sce = copy(SCE_CONTEXTS); var sce = copy(SCE_CONTEXTS);
...@@ -13003,6 +13057,7 @@ function $SnifferProvider() { ...@@ -13003,6 +13057,7 @@ function $SnifferProvider() {
int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
boxee = /Boxee/i.test(($window.navigator || {}).userAgent), boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
document = $document[0] || {}, document = $document[0] || {},
documentMode = document.documentMode,
vendorPrefix, vendorPrefix,
vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/, vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
bodyStyle = document.body && document.body.style, bodyStyle = document.body && document.body.style,
...@@ -13047,7 +13102,7 @@ function $SnifferProvider() { ...@@ -13047,7 +13102,7 @@ function $SnifferProvider() {
// jshint +W018 // jshint +W018
hashchange: 'onhashchange' in $window && hashchange: 'onhashchange' in $window &&
// IE8 compatible mode lies // IE8 compatible mode lies
(!document.documentMode || document.documentMode > 7), (!documentMode || documentMode > 7),
hasEvent: function(event) { hasEvent: function(event) {
// IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
// it. In particular the event is not fired when backspace or delete key are pressed or // it. In particular the event is not fired when backspace or delete key are pressed or
...@@ -13065,7 +13120,8 @@ function $SnifferProvider() { ...@@ -13065,7 +13120,8 @@ function $SnifferProvider() {
vendorPrefix: vendorPrefix, vendorPrefix: vendorPrefix,
transitions : transitions, transitions : transitions,
animations : animations, animations : animations,
msie : msie msie : msie,
msieDocumentMode: documentMode
}; };
}]; }];
} }
...@@ -14680,8 +14736,11 @@ var htmlAnchorDirective = valueFn({ ...@@ -14680,8 +14736,11 @@ var htmlAnchorDirective = valueFn({
* *
* The HTML specification does not require browsers to preserve the values of boolean attributes * The HTML specification does not require browsers to preserve the values of boolean attributes
* such as disabled. (Their presence means true and their absence means false.) * such as disabled. (Their presence means true and their absence means false.)
* This prevents the Angular compiler from retrieving the binding expression. * If we put an Angular interpolation expression into such an attribute then the
* binding information would be lost when the browser removes the attribute.
* The `ngDisabled` directive solves this problem for the `disabled` attribute. * The `ngDisabled` directive solves this problem for the `disabled` attribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
* *
* @example * @example
<doc:example> <doc:example>
...@@ -14712,8 +14771,11 @@ var htmlAnchorDirective = valueFn({ ...@@ -14712,8 +14771,11 @@ var htmlAnchorDirective = valueFn({
* @description * @description
* The HTML specification does not require browsers to preserve the values of boolean attributes * The HTML specification does not require browsers to preserve the values of boolean attributes
* such as checked. (Their presence means true and their absence means false.) * such as checked. (Their presence means true and their absence means false.)
* This prevents the Angular compiler from retrieving the binding expression. * If we put an Angular interpolation expression into such an attribute then the
* binding information would be lost when the browser removes the attribute.
* The `ngChecked` directive solves this problem for the `checked` attribute. * The `ngChecked` directive solves this problem for the `checked` attribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
* @example * @example
<doc:example> <doc:example>
<doc:source> <doc:source>
...@@ -14743,8 +14805,12 @@ var htmlAnchorDirective = valueFn({ ...@@ -14743,8 +14805,12 @@ var htmlAnchorDirective = valueFn({
* @description * @description
* The HTML specification does not require browsers to preserve the values of boolean attributes * The HTML specification does not require browsers to preserve the values of boolean attributes
* such as readonly. (Their presence means true and their absence means false.) * such as readonly. (Their presence means true and their absence means false.)
* This prevents the Angular compiler from retrieving the binding expression. * If we put an Angular interpolation expression into such an attribute then the
* binding information would be lost when the browser removes the attribute.
* The `ngReadonly` directive solves this problem for the `readonly` attribute. * The `ngReadonly` directive solves this problem for the `readonly` attribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
* @example * @example
<doc:example> <doc:example>
<doc:source> <doc:source>
...@@ -14774,8 +14840,11 @@ var htmlAnchorDirective = valueFn({ ...@@ -14774,8 +14840,11 @@ var htmlAnchorDirective = valueFn({
* @description * @description
* The HTML specification does not require browsers to preserve the values of boolean attributes * The HTML specification does not require browsers to preserve the values of boolean attributes
* such as selected. (Their presence means true and their absence means false.) * such as selected. (Their presence means true and their absence means false.)
* This prevents the Angular compiler from retrieving the binding expression. * If we put an Angular interpolation expression into such an attribute then the
* binding information would be lost when the browser removes the attribute.
* The `ngSelected` directive solves this problem for the `selected` atttribute. * The `ngSelected` directive solves this problem for the `selected` atttribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
* @example * @example
<doc:example> <doc:example>
<doc:source> <doc:source>
...@@ -14807,8 +14876,12 @@ var htmlAnchorDirective = valueFn({ ...@@ -14807,8 +14876,12 @@ var htmlAnchorDirective = valueFn({
* @description * @description
* The HTML specification does not require browsers to preserve the values of boolean attributes * The HTML specification does not require browsers to preserve the values of boolean attributes
* such as open. (Their presence means true and their absence means false.) * such as open. (Their presence means true and their absence means false.)
* This prevents the Angular compiler from retrieving the binding expression. * If we put an Angular interpolation expression into such an attribute then the
* binding information would be lost when the browser removes the attribute.
* The `ngOpen` directive solves this problem for the `open` attribute. * The `ngOpen` directive solves this problem for the `open` attribute.
* This complementary directive is not removed by the browser and so provides
* a permanent reliable place to store the binding information.
* *
* @example * @example
<doc:example> <doc:example>
...@@ -15638,8 +15711,21 @@ var inputType = { ...@@ -15638,8 +15711,21 @@ var inputType = {
function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
// In composition mode, users are still inputing intermediate text buffer,
// hold the listener until composition is done.
// More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
var composing = false;
element.on('compositionstart', function() {
composing = true;
});
element.on('compositionend', function() {
composing = false;
});
var listener = function() { var listener = function() {
if (composing) return;
var value = element.val(); var value = element.val();
// By default we will trim the value // By default we will trim the value
...@@ -16929,11 +17015,10 @@ function classDirective(name, selector) { ...@@ -16929,11 +17015,10 @@ function classDirective(name, selector) {
// jshint bitwise: false // jshint bitwise: false
var mod = $index & 1; var mod = $index & 1;
if (mod !== old$index & 1) { if (mod !== old$index & 1) {
if (mod === selector) { var classes = flattenClasses(scope.$eval(attr[name]));
addClass(scope.$eval(attr[name])); mod === selector ?
} else { attr.$addClass(classes) :
removeClass(scope.$eval(attr[name])); attr.$removeClass(classes);
}
} }
}); });
} }
...@@ -16941,24 +17026,17 @@ function classDirective(name, selector) { ...@@ -16941,24 +17026,17 @@ function classDirective(name, selector) {
function ngClassWatchAction(newVal) { function ngClassWatchAction(newVal) {
if (selector === true || scope.$index % 2 === selector) { if (selector === true || scope.$index % 2 === selector) {
if (oldVal && !equals(newVal,oldVal)) { var newClasses = flattenClasses(newVal || '');
removeClass(oldVal); if(!oldVal) {
attr.$addClass(newClasses);
} else if(!equals(newVal,oldVal)) {
attr.$updateClass(newClasses, flattenClasses(oldVal));
} }
addClass(newVal);
} }
oldVal = copy(newVal); oldVal = copy(newVal);
} }
function removeClass(classVal) {
attr.$removeClass(flattenClasses(classVal));
}
function addClass(classVal) {
attr.$addClass(flattenClasses(classVal));
}
function flattenClasses(classVal) { function flattenClasses(classVal) {
if(isArray(classVal)) { if(isArray(classVal)) {
return classVal.join(' '); return classVal.join(' ');
...@@ -17436,7 +17514,8 @@ var ngCloakDirective = ngDirective({ ...@@ -17436,7 +17514,8 @@ var ngCloakDirective = ngDirective({
var ngControllerDirective = [function() { var ngControllerDirective = [function() {
return { return {
scope: true, scope: true,
controller: '@' controller: '@',
priority: 500
}; };
}]; }];
...@@ -18132,7 +18211,13 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' ...@@ -18132,7 +18211,13 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
if (thisChangeId !== changeCounter) return; if (thisChangeId !== changeCounter) return;
var newScope = scope.$new(); var newScope = scope.$new();
$transclude(newScope, function(clone) { // Note: This will also link all children of ng-include that were contained in the original
// html. If that content contains controllers, ... they could pollute/change the scope.
// However, using ng-include on an element with additional content does not make sense...
// Note: We can't remove them in the cloneAttchFn of $transclude as that
// function is called before linking the content, which would apply child
// directives to non existing elements.
var clone = $transclude(newScope, noop);
cleanupLastIncludeContent(); cleanupLastIncludeContent();
currentScope = newScope; currentScope = newScope;
...@@ -18143,7 +18228,6 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile' ...@@ -18143,7 +18228,6 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
$compile(currentElement.contents())(currentScope); $compile(currentElement.contents())(currentScope);
currentScope.$emit('$includeContentLoaded'); currentScope.$emit('$includeContentLoaded');
scope.$eval(onloadExp); scope.$eval(onloadExp);
});
}).error(function() { }).error(function() {
if (thisChangeId === changeCounter) cleanupLastIncludeContent(); if (thisChangeId === changeCounter) cleanupLastIncludeContent();
}); });
...@@ -18298,7 +18382,7 @@ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); ...@@ -18298,7 +18382,7 @@ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
* other numbers, for example 12, so that instead of showing "12 people are viewing", you can * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
* show "a dozen people are viewing". * show "a dozen people are viewing".
* *
* You can use a set of closed braces(`{}`) as a placeholder for the number that you want substituted * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
* into pluralized strings. In the previous example, Angular will replace `{}` with * into pluralized strings. In the previous example, Angular will replace `{}` with
* <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
* for <span ng-non-bindable>{{numberExpression}}</span>. * for <span ng-non-bindable>{{numberExpression}}</span>.
...@@ -18559,7 +18643,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp ...@@ -18559,7 +18643,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp
* For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
* `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
* with the corresponding item in the array by identity. Moving the same object in array would move the DOM * with the corresponding item in the array by identity. Moving the same object in array would move the DOM
* element in the same way ian the DOM. * element in the same way in the DOM.
* *
* For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
* case the object identity does not matter. Two objects are considered equivalent as long as their `id` * case the object identity does not matter. Two objects are considered equivalent as long as their `id`
...@@ -20128,4 +20212,4 @@ var styleDirective = valueFn({ ...@@ -20128,4 +20212,4 @@ var styleDirective = valueFn({
})(window, document); })(window, document);
!angular.$$csp() && angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-start{clip:rect(0,auto,auto,0);-ms-zoom:1.0001;}.ng-animate-active{clip:rect(-1px,auto,auto,0);-ms-zoom:1;}</style>'); !angular.$$csp() && angular.element(document).find('head').prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-start{border-spacing:1px 1px;-ms-zoom:1.0001;}.ng-animate-active{border-spacing:0px 0px;-ms-zoom:1;}</style>');
\ No newline at end of file \ No newline at end of file
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