vendor/assets/javascripts/unstable/angular-messages.js in angularjs-rails-1.3.0 vs vendor/assets/javascripts/unstable/angular-messages.js in angularjs-rails-1.3.1

- old
+ new

@@ -1,7 +1,7 @@ /** - * @license AngularJS v1.3.0 + * @license AngularJS v1.3.1 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; @@ -243,16 +243,16 @@ controller: function() { this.$renderNgMessageClasses = angular.noop; var messages = []; this.registerMessage = function(index, message) { - for(var i = 0; i < messages.length; i++) { - if(messages[i].type == message.type) { - if(index != i) { + for (var i = 0; i < messages.length; i++) { + if (messages[i].type == message.type) { + if (index != i) { var temp = messages[index]; messages[index] = messages[i]; - if(index < messages.length) { + if (index < messages.length) { messages[i] = temp; } else { messages.splice(0, i); //remove the old one (and shift left) } } @@ -265,11 +265,11 @@ this.renderMessages = function(values, multiple) { values = values || {}; var found; angular.forEach(messages, function(message) { - if((!found || multiple) && truthyVal(values[message.type])) { + if ((!found || multiple) && truthyVal(values[message.type])) { message.attach(); found = true; } else { message.detach(); } @@ -298,11 +298,11 @@ cachedValues = values; ctrl.renderMessages(values, multiple); }); var tpl = $attrs.ngMessagesInclude || $attrs.include; - if(tpl) { + if (tpl) { $templateRequest(tpl) .then(function processTemplate(html) { var after, container = angular.element('<div/>').html(html); angular.forEach(container.children(), function(elm) { elm = angular.element(elm); @@ -362,32 +362,32 @@ link: function($scope, $element, $attrs, ngMessages, $transclude) { var index, element; var commentNode = $element[0]; var parentNode = commentNode.parentNode; - for(var i = 0, j = 0; i < parentNode.childNodes.length; i++) { + for (var i = 0, j = 0; i < parentNode.childNodes.length; i++) { var node = parentNode.childNodes[i]; - if(node.nodeType == COMMENT_NODE && node.nodeValue.indexOf('ngMessage') >= 0) { - if(node === commentNode) { + if (node.nodeType == COMMENT_NODE && node.nodeValue.indexOf('ngMessage') >= 0) { + if (node === commentNode) { index = j; break; } j++; } } ngMessages.registerMessage(index, { - type : $attrs.ngMessage || $attrs.when, - attach : function() { - if(!element) { + type: $attrs.ngMessage || $attrs.when, + attach: function() { + if (!element) { $transclude($scope, function(clone) { $animate.enter(clone, null, $element); element = clone; }); } }, - detach : function(now) { - if(element) { + detach: function(now) { + if (element) { $animate.leave(element); element = null; } } });