diff options
Diffstat (limited to 'js/vendor/angular/angular.js')
-rw-r--r-- | js/vendor/angular/angular.js | 991 |
1 files changed, 516 insertions, 475 deletions
diff --git a/js/vendor/angular/angular.js b/js/vendor/angular/angular.js index b804d6490..f00be244e 100644 --- a/js/vendor/angular/angular.js +++ b/js/vendor/angular/angular.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.3.0 + * @license AngularJS v1.3.1 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ @@ -37,12 +37,12 @@ function minErr(module, ErrorConstructor) { ErrorConstructor = ErrorConstructor || Error; - return function () { + return function() { var code = arguments[0], prefix = '[' + (module ? module + ':' : '') + code + '] ', template = arguments[1], templateArgs = arguments, - stringify = function (obj) { + stringify = function(obj) { if (typeof obj === 'function') { return obj.toString().replace(/ \{[\s\S]*$/, ''); } else if (typeof obj === 'undefined') { @@ -54,7 +54,7 @@ function minErr(module, ErrorConstructor) { }, message, i; - message = prefix + template.replace(/\{\d+\}/g, function (match) { + message = prefix + template.replace(/\{\d+\}/g, function(match) { var index = +match.slice(1, -1), arg; if (index + 2 < templateArgs.length) { @@ -71,7 +71,7 @@ function minErr(module, ErrorConstructor) { return match; }); - message = message + '\nhttp://errors.angularjs.org/1.3.0/' + + message = message + '\nhttp://errors.angularjs.org/1.3.1/' + (module ? module + '/' : '') + code; for (i = 2; i < arguments.length; i++) { message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' + @@ -130,12 +130,11 @@ function minErr(module, ErrorConstructor) { isBoolean: true, isPromiseLike: true, trim: true, + escapeForRegexp: true, isElement: true, makeMap: true, - size: true, includes: true, arrayRemove: true, - isLeafNode: true, copy: true, shallowCopy: true, equals: true, @@ -205,7 +204,7 @@ var VALIDITY_STATE_PROPERTY = 'validity'; * @param {string} string String to be converted to lowercase. * @returns {string} Lowercased string. */ -var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;}; +var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;}; var hasOwnProperty = Object.prototype.hasOwnProperty; /** @@ -218,7 +217,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; * @param {string} string String to be converted to uppercase. * @returns {string} Uppercased string. */ -var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;}; +var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;}; var manualLowercase = function(s) { @@ -302,6 +301,11 @@ function isArrayLike(obj) { * It is worth noting that `.forEach` does not iterate over inherited properties because it filters * using the `hasOwnProperty` method. * + * Unlike ES262's + * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18), + * Providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just + * return the value provided. + * ```js var values = {name: 'misko', gender: 'male'}; var log = []; @@ -349,18 +353,12 @@ function forEach(obj, iterator, context) { } function sortedKeys(obj) { - var keys = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - keys.push(key); - } - } - return keys.sort(); + return Object.keys(obj).sort(); } function forEachSorted(obj, iterator, context) { var keys = sortedKeys(obj); - for ( var i = 0; i < keys.length; i++) { + for (var i = 0; i < keys.length; i++) { iterator.call(context, obj[keys[i]], keys[i]); } return keys; @@ -415,6 +413,7 @@ function setHashKey(obj, h) { * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s) * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`. + * Note: Keep in mind that `angular.extend` does not support recursive merge (deep copy). * * @param {Object} dst Destination object. * @param {...Object} src Source object(s). @@ -501,7 +500,7 @@ function valueFn(value) {return function() {return value;};} * @param {*} value Reference to check. * @returns {boolean} True if `value` is undefined. */ -function isUndefined(value){return typeof value === 'undefined';} +function isUndefined(value) {return typeof value === 'undefined';} /** @@ -516,7 +515,7 @@ function isUndefined(value){return typeof value === 'undefined';} * @param {*} value Reference to check. * @returns {boolean} True if `value` is defined. */ -function isDefined(value){return typeof value !== 'undefined';} +function isDefined(value) {return typeof value !== 'undefined';} /** @@ -532,7 +531,7 @@ function isDefined(value){return typeof value !== 'undefined';} * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Object` but not `null`. */ -function isObject(value){ +function isObject(value) { // http://jsperf.com/isobject4 return value !== null && typeof value === 'object'; } @@ -550,7 +549,7 @@ function isObject(value){ * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `String`. */ -function isString(value){return typeof value === 'string';} +function isString(value) {return typeof value === 'string';} /** @@ -565,7 +564,7 @@ function isString(value){return typeof value === 'string';} * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Number`. */ -function isNumber(value){return typeof value === 'number';} +function isNumber(value) {return typeof value === 'number';} /** @@ -611,7 +610,7 @@ var isArray = Array.isArray; * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Function`. */ -function isFunction(value){return typeof value === 'function';} +function isFunction(value) {return typeof value === 'function';} /** @@ -667,6 +666,14 @@ var trim = function(value) { return isString(value) ? value.trim() : value; }; +// Copied from: +// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021 +// Prereq: s is a string. +var escapeForRegexp = function(s) { + return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1'). + replace(/\x08/g, '\\x08'); +}; + /** * @ngdoc function @@ -692,7 +699,7 @@ function isElement(node) { */ function makeMap(str) { var obj = {}, items = str.split(","), i; - for ( i = 0; i < items.length; i++ ) + for (i = 0; i < items.length; i++) obj[ items[i] ] = true; return obj; } @@ -702,34 +709,6 @@ function nodeName_(element) { return lowercase(element.nodeName || element[0].nodeName); } - -/** - * @description - * Determines the number of elements in an array, the number of properties an object has, or - * the length of a string. - * - * Note: This function is used to augment the Object type in Angular expressions. See - * {@link angular.Object} for more information about Angular arrays. - * - * @param {Object|Array|string} obj Object, array, or string to inspect. - * @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object - * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array. - */ -function size(obj, ownPropsOnly) { - var count = 0, key; - - if (isArray(obj) || isString(obj)) { - return obj.length; - } else if (isObject(obj)) { - for (key in obj) - if (!ownPropsOnly || obj.hasOwnProperty(key)) - count++; - } - - return count; -} - - function includes(array, obj) { return Array.prototype.indexOf.call(array, obj) != -1; } @@ -741,18 +720,6 @@ function arrayRemove(array, value) { return value; } -function isLeafNode (node) { - if (node) { - switch (nodeName_(node)) { - case "option": - case "pre": - case "title": - return true; - } - } - return false; -} - /** * @ngdoc function * @name angular.copy @@ -850,7 +817,7 @@ function copy(source, destination, stackSource, stackDest) { var result; if (isArray(source)) { destination.length = 0; - for ( var i = 0; i < source.length; i++) { + for (var i = 0; i < source.length; i++) { result = copy(source[i], null, stackSource, stackDest); if (isObject(source[i])) { stackSource.push(source[i]); @@ -867,8 +834,8 @@ function copy(source, destination, stackSource, stackDest) { delete destination[key]; }); } - for ( var key in source) { - if(source.hasOwnProperty(key)) { + for (var key in source) { + if (source.hasOwnProperty(key)) { result = copy(source[key], null, stackSource, stackDest); if (isObject(source[key])) { stackSource.push(source[key]); @@ -949,7 +916,7 @@ function equals(o1, o2) { if (isArray(o1)) { if (!isArray(o2)) return false; if ((length = o1.length) == o2.length) { - for(key=0; key<length; key++) { + for (key=0; key<length; key++) { if (!equals(o1[key], o2[key])) return false; } return true; @@ -962,12 +929,12 @@ function equals(o1, o2) { } else { if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false; keySet = {}; - for(key in o1) { + for (key in o1) { if (key.charAt(0) === '$' || isFunction(o1[key])) continue; if (!equals(o1[key], o2[key])) return false; keySet[key] = true; } - for(key in o2) { + for (key in o2) { if (!keySet.hasOwnProperty(key) && key.charAt(0) !== '$' && o2[key] !== undefined && @@ -1115,14 +1082,14 @@ function startingTag(element) { // turns out IE does not let you set .html() on elements which // are not allowed to have children. So we just ignore it. element.empty(); - } catch(e) {} + } catch (e) {} var elemHtml = jqLite('<div>').append(element).html(); try { return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : elemHtml. match(/^(<[^>]+>)/)[1]. replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); }); - } catch(e) { + } catch (e) { return lowercase(elemHtml); } @@ -1142,7 +1109,7 @@ function startingTag(element) { function tryDecodeURIComponent(value) { try { return decodeURIComponent(value); - } catch(e) { + } catch (e) { // Ignore any invalid uri component } } @@ -1155,14 +1122,14 @@ function tryDecodeURIComponent(value) { function parseKeyValue(/**string*/keyValue) { var obj = {}, key_value, key; forEach((keyValue || "").split('&'), function(keyValue) { - if ( keyValue ) { + if (keyValue) { key_value = keyValue.replace(/\+/g,'%20').split('='); key = tryDecodeURIComponent(key_value[0]); - if ( isDefined(key) ) { + if (isDefined(key)) { var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true; if (!hasOwnProperty.call(obj, key)) { obj[key] = val; - } else if(isArray(obj[key])) { + } else if (isArray(obj[key])) { obj[key].push(val); } else { obj[key] = [obj[key],val]; @@ -1999,7 +1966,7 @@ function setupModuleLoader(window) { config(configFn); } - return moduleInstance; + return moduleInstance; /** * @param {string} provider @@ -2122,15 +2089,15 @@ function setupModuleLoader(window) { * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { - full: '1.3.0', // all of these placeholder strings will be replaced by grunt's + full: '1.3.1', // all of these placeholder strings will be replaced by grunt's major: 1, // package task minor: 3, - dot: 0, - codeName: 'superluminal-nudge' + dot: 1, + codeName: 'spectral-lobster' }; -function publishExternalAPI(angular){ +function publishExternalAPI(angular) { extend(angular, { 'bootstrap': bootstrap, 'copy': copy, @@ -2256,7 +2223,7 @@ function publishExternalAPI(angular){ $timeout: $TimeoutProvider, $window: $WindowProvider, $$rAF: $$RAFProvider, - $$asyncCallback : $$AsyncCallbackProvider + $$asyncCallback: $$AsyncCallbackProvider }); } ]); @@ -2306,7 +2273,7 @@ function publishExternalAPI(angular){ * - [`children()`](http://api.jquery.com/children/) - Does not support selectors * - [`clone()`](http://api.jquery.com/clone/) * - [`contents()`](http://api.jquery.com/contents/) - * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyles()` + * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()` * - [`data()`](http://api.jquery.com/data/) * - [`detach()`](http://api.jquery.com/detach/) * - [`empty()`](http://api.jquery.com/empty/) @@ -2384,7 +2351,7 @@ function jqNextId() { return ++jqId; } var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; var MOZ_HACK_REGEXP = /^moz([A-Z])/; -var MOUSE_EVENT_MAP= { mouseleave : "mouseout", mouseenter : "mouseover"}; +var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"}; var jqLiteMinErr = minErr('jqLite'); /** @@ -2513,7 +2480,7 @@ function jqLiteClone(element) { return element.cloneNode(true); } -function jqLiteDealoc(element, onlyDescendants){ +function jqLiteDealoc(element, onlyDescendants) { if (!onlyDescendants) jqLiteRemoveData(element); if (element.querySelectorAll) { @@ -2620,7 +2587,7 @@ function jqLiteData(element, key, value) { function jqLiteHasClass(element, selector) { if (!element.getAttribute) return false; return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " "). - indexOf( " " + selector + " " ) > -1); + indexOf(" " + selector + " ") > -1); } function jqLiteRemoveClass(element, cssClasses) { @@ -2679,13 +2646,13 @@ function jqLiteAddNodes(root, elements) { function jqLiteController(element, name) { - return jqLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller'); + return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller'); } function jqLiteInheritedData(element, name, value) { // if element is the document object work with the html element instead // this makes $(document).scope() possible - if(element.nodeType == NODE_TYPE_DOCUMENT) { + if (element.nodeType == NODE_TYPE_DOCUMENT) { element = element.documentElement; } var names = isArray(name) ? name : [name]; @@ -2743,7 +2710,7 @@ var JQLitePrototype = JQLite.prototype = { } // check if document is already loaded - if (document.readyState === 'complete'){ + if (document.readyState === 'complete') { setTimeout(trigger); } else { this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9 @@ -2751,12 +2718,11 @@ var JQLitePrototype = JQLite.prototype = { // jshint -W064 JQLite(window).on('load', trigger); // fallback to window.onload for others // jshint +W064 - this.on('DOMContentLoaded', trigger); } }, toString: function() { var value = []; - forEach(this, function(e){ value.push('' + e);}); + forEach(this, function(e) { value.push('' + e);}); return '[' + value.join(', ') + ']'; }, @@ -2784,11 +2750,11 @@ forEach('input,select,option,textarea,button,form,details'.split(','), function( BOOLEAN_ELEMENTS[value] = true; }); var ALIASED_ATTR = { - 'ngMinlength' : 'minlength', - 'ngMaxlength' : 'maxlength', - 'ngMin' : 'min', - 'ngMax' : 'max', - 'ngPattern' : 'pattern' + 'ngMinlength': 'minlength', + 'ngMaxlength': 'maxlength', + 'ngMin': 'min', + 'ngMax': 'max', + 'ngPattern': 'pattern' }; function getBooleanAttrName(element, name) { @@ -2847,7 +2813,7 @@ forEach({ } }, - attr: function(element, name, value){ + attr: function(element, name, value) { var lowercasedName = lowercase(name); if (BOOLEAN_ATTR[lowercasedName]) { if (isDefined(value)) { @@ -2900,7 +2866,7 @@ forEach({ if (isUndefined(value)) { if (element.multiple && nodeName_(element) === 'select') { var result = []; - forEach(element.options, function (option) { + forEach(element.options, function(option) { if (option.selected) { result.push(option.value || option.text); } @@ -2921,7 +2887,7 @@ forEach({ }, empty: jqLiteEmpty -}, function(fn, name){ +}, function(fn, name) { /** * Properties: writes return selection, reads return first value */ @@ -2973,7 +2939,7 @@ forEach({ }); function createEventHandler(element, events) { - var eventHandler = function (event, type) { + var eventHandler = function(event, type) { // jQuery specific api event.isDefaultPrevented = function() { return event.defaultPrevented; @@ -3029,7 +2995,7 @@ function createEventHandler(element, events) { forEach({ removeData: jqLiteRemoveData, - on: function jqLiteOn(element, type, fn, unsupported){ + on: function jqLiteOn(element, type, fn, unsupported) { if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters'); // Do not add event handlers to non-elements because they will not be cleaned up. @@ -3065,7 +3031,7 @@ forEach({ var target = this, related = event.relatedTarget; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !target.contains(related)) ){ + if (!related || (related !== target && !target.contains(related))) { handle(event, type); } }); @@ -3099,7 +3065,7 @@ forEach({ replaceWith: function(element, replaceNode) { var index, parent = element.parentNode; jqLiteDealoc(element); - forEach(new JQLite(replaceNode), function(node){ + forEach(new JQLite(replaceNode), function(node) { if (index) { parent.insertBefore(node, index.nextSibling); } else { @@ -3111,7 +3077,7 @@ forEach({ children: function(element) { var children = []; - forEach(element.childNodes, function(element){ + forEach(element.childNodes, function(element) { if (element.nodeType === NODE_TYPE_ELEMENT) children.push(element); }); @@ -3137,7 +3103,7 @@ forEach({ prepend: function(element, node) { if (element.nodeType === NODE_TYPE_ELEMENT) { var index = element.firstChild; - forEach(new JQLite(node), function(child){ + forEach(new JQLite(node), function(child) { element.insertBefore(child, index); }); } @@ -3174,7 +3140,7 @@ forEach({ toggleClass: function(element, selector, condition) { if (selector) { - forEach(selector.split(' '), function(className){ + forEach(selector.split(' '), function(className) { var classCondition = condition; if (isUndefined(classCondition)) { classCondition = !jqLiteHasClass(element, className); @@ -3239,14 +3205,14 @@ forEach({ }); } } -}, function(fn, name){ +}, function(fn, name) { /** * chaining functions */ JQLite.prototype[name] = function(arg1, arg2, arg3) { var value; - for(var i = 0, ii = this.length; i < ii; i++) { + for (var i = 0, ii = this.length; i < ii; i++) { if (isUndefined(value)) { value = fn(this[i], arg1, arg2, arg3); if (isDefined(value)) { @@ -4043,7 +4009,7 @@ function createInjector(modulesToLoad, strictDi) { //////////////////////////////////// // Module Loading //////////////////////////////////// - function loadModules(modulesToLoad){ + function loadModules(modulesToLoad) { var runBlocks = [], moduleFn; forEach(modulesToLoad, function(module) { if (loadedModules.get(module)) return; @@ -4051,7 +4017,7 @@ function createInjector(modulesToLoad, strictDi) { function runInvokeQueue(queue) { var i, ii; - for(i = 0, ii = queue.length; i < ii; i++) { + for (i = 0, ii = queue.length; i < ii; i++) { var invokeArgs = queue[i], provider = providerInjector.get(invokeArgs[0]); @@ -4131,7 +4097,7 @@ function createInjector(modulesToLoad, strictDi) { length, i, key; - for(i = 0, length = $inject.length; i < length; i++) { + for (i = 0, length = $inject.length; i < length; i++) { key = $inject[i]; if (typeof key !== 'string') { throw $injectorMinErr('itkn', @@ -4347,7 +4313,6 @@ function $AnchorScrollProvider() { */ this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) { var document = $window.document; - var scrollScheduled = false; // Helper function to get first anchor from a NodeList // (using `Array#some()` instead of `angular#forEach()` since it's more performant @@ -4521,7 +4486,7 @@ var $AnimateProvider = ['$provide', function($provide) { * @return {RegExp} The current CSS className expression value. If null then there is no expression value */ this.classNameFilter = function(expression) { - if(arguments.length === 1) { + if (arguments.length === 1) { this.$$classNameFilter = (expression instanceof RegExp) ? expression : null; } return this.$$classNameFilter; @@ -4616,7 +4581,7 @@ var $AnimateProvider = ['$provide', function($provide) { * page}. */ return { - animate : function(element, from, to) { + animate: function(element, from, to) { applyStyles(element, { from: from, to: to }); return asyncPromise(); }, @@ -4637,7 +4602,7 @@ var $AnimateProvider = ['$provide', function($provide) { * @param {object=} options an optional collection of styles that will be applied to the element. * @return {Promise} the animation callback promise */ - enter : function(element, parent, after, options) { + enter: function(element, parent, after, options) { applyStyles(element, options); after ? after.after(element) : parent.prepend(element); @@ -4655,7 +4620,7 @@ var $AnimateProvider = ['$provide', function($provide) { * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ - leave : function(element, options) { + leave: function(element, options) { element.remove(); return asyncPromise(); }, @@ -4678,7 +4643,7 @@ var $AnimateProvider = ['$provide', function($provide) { * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ - move : function(element, parent, after, options) { + move: function(element, parent, after, options) { // Do not remove element before insert. Removing will cause data associated with the // element to be dropped. Insert will implicitly do the remove. return this.enter(element, parent, after, options); @@ -4697,16 +4662,16 @@ var $AnimateProvider = ['$provide', function($provide) { * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ - addClass : function(element, className, options) { + addClass: function(element, className, options) { return this.setClass(element, className, [], options); }, - $$addClassImmediately : function(element, className, options) { + $$addClassImmediately: function(element, className, options) { element = jqLite(element); className = !isString(className) ? (isArray(className) ? className.join(' ') : '') : className; - forEach(element, function (element) { + forEach(element, function(element) { jqLiteAddClass(element, className); }); applyStyles(element, options); @@ -4726,16 +4691,16 @@ var $AnimateProvider = ['$provide', function($provide) { * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ - removeClass : function(element, className, options) { + removeClass: function(element, className, options) { return this.setClass(element, [], className, options); }, - $$removeClassImmediately : function(element, className, options) { + $$removeClassImmediately: function(element, className, options) { element = jqLite(element); className = !isString(className) ? (isArray(className) ? className.join(' ') : '') : className; - forEach(element, function (element) { + forEach(element, function(element) { jqLiteRemoveClass(element, className); }); applyStyles(element, options); @@ -4756,7 +4721,7 @@ var $AnimateProvider = ['$provide', function($provide) { * @param {object=} options an optional collection of options that will be applied to the element. * @return {Promise} the animation callback promise */ - setClass : function(element, add, remove, options) { + setClass: function(element, add, remove, options) { var self = this; var STORAGE_KEY = '$$animateClasses'; var createdCache = false; @@ -4766,7 +4731,7 @@ var $AnimateProvider = ['$provide', function($provide) { if (!cache) { cache = { classes: {}, - options : options + options: options }; createdCache = true; } else if (options && cache.options) { @@ -4803,20 +4768,20 @@ var $AnimateProvider = ['$provide', function($provide) { return cache.promise; }, - $$setClassImmediately : function(element, add, remove, options) { + $$setClassImmediately: function(element, add, remove, options) { add && this.$$addClassImmediately(element, add); remove && this.$$removeClassImmediately(element, remove); applyStyles(element, options); return asyncPromise(); }, - enabled : noop, - cancel : noop + enabled: noop, + cancel: noop }; }]; }]; -function $$AsyncCallbackProvider(){ +function $$AsyncCallbackProvider() { this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) { return $$rAF.supported ? function(fn) { return $$rAF(fn); } @@ -4878,7 +4843,7 @@ function Browser(window, document, $log, $sniffer) { } finally { outstandingRequestCount--; if (outstandingRequestCount === 0) { - while(outstandingRequestCallbacks.length) { + while (outstandingRequestCallbacks.length) { try { outstandingRequestCallbacks.pop()(); } catch (e) { @@ -4899,7 +4864,7 @@ function Browser(window, document, $log, $sniffer) { // force browser to execute all pollFns - this is needed so that cookies and other pollers fire // at some deterministic time in respect to the test runner's actions. Leaving things up to the // regular poller would result in flaky tests. - forEach(pollFns, function(pollFn){ pollFn(); }); + forEach(pollFns, function(pollFn) { pollFn(); }); if (outstandingRequestCount === 0) { callback(); @@ -4941,7 +4906,7 @@ function Browser(window, document, $log, $sniffer) { */ function startPoller(interval, setTimeout) { (function check() { - forEach(pollFns, function(pollFn){ pollFn(); }); + forEach(pollFns, function(pollFn) { pollFn(); }); pollTimeout = setTimeout(check, interval); })(); } @@ -5276,9 +5241,9 @@ function Browser(window, document, $log, $sniffer) { } -function $BrowserProvider(){ +function $BrowserProvider() { this.$get = ['$window', '$log', '$sniffer', '$document', - function( $window, $log, $sniffer, $document){ + function($window, $log, $sniffer, $document) { return new Browser($window, $document, $log, $sniffer); }]; } @@ -5652,7 +5617,8 @@ function $CacheFactoryProvider() { * ``` * * **Note:** the `script` tag containing the template does not need to be included in the `head` of - * the document, but it must be below the `ng-app` definition. + * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE, + * element with ng-app attribute), otherwise the template will be ignored. * * Adding via the $templateCache service: * @@ -5846,7 +5812,9 @@ function $TemplateCacheProvider() { * value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected * in `localModel` and any changes in `localModel` will reflect in `parentModel`. If the parent * scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You - * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional. + * can avoid this behavior using `=?` or `=?attr` in order to flag the property as optional. If + * you want to shallow watch for changes (i.e. $watchCollection instead of $watch) you can use + * `=*` or `=*attr` (`=*?` or `=*?attr` if the property is optional). * * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. * If no `attr` name is specified then the attribute name is assumed to be the same as the @@ -6362,8 +6330,8 @@ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider']; function $CompileProvider($provide, $$sanitizeUriProvider) { var hasDirectives = {}, Suffix = 'Directive', - COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/, - CLASS_DIRECTIVE_REGEXP = /(([\d\w_\-]+)(?:\:([^;]+))?;?)/, + COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/, + CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/, ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'), REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/; @@ -6373,7 +6341,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; function parseIsolateBindings(scope, directiveName) { - var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/; + var LOCAL_REGEXP = /^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/; var bindings = {}; @@ -6388,9 +6356,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { } bindings[scopeName] = { - attrName: match[3] || scopeName, - mode: match[1], - optional: match[2] === '?' + mode: match[1][0], + collection: match[2] === '*', + optional: match[3] === '?', + attrName: match[4] || scopeName }; }); @@ -6536,7 +6505,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { */ var debugInfoEnabled = true; this.debugInfoEnabled = function(enabled) { - if(isDefined(enabled)) { + if (isDefined(enabled)) { debugInfoEnabled = enabled; return this; } @@ -6580,8 +6549,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { * * @param {string} classVal The className value that will be added to the element */ - $addClass : function(classVal) { - if(classVal && classVal.length > 0) { + $addClass: function(classVal) { + if (classVal && classVal.length > 0) { $animate.addClass(this.$$element, classVal); } }, @@ -6597,8 +6566,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { * * @param {string} classVal The className value that will be removed from the element */ - $removeClass : function(classVal) { - if(classVal && classVal.length > 0) { + $removeClass: function(classVal) { + if (classVal && classVal.length > 0) { $animate.removeClass(this.$$element, classVal); } }, @@ -6615,7 +6584,7 @@ |